Register stories at configure() time to fix bootstrap#62
Open
EmilioBejasa wants to merge 3 commits intomainfrom
Open
Register stories at configure() time to fix bootstrap#62EmilioBejasa wants to merge 3 commits intomainfrom
EmilioBejasa wants to merge 3 commits intomainfrom
Conversation
Previously registerStoriesWithNative() was called inside StoryRenderer's useEffect, which required the component to render and createPreparedStoryMapping() to complete before the manifest was written. This made bootstrap unreliable within the 10-second timeout. Move the call into configure(), which runs synchronously at JS bundle load time when _storyIndex is freshly populated by start(). Keep a fallback call in the useEffect after createPreparedStoryMapping() for defense in depth. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
configure() now calls registerStoriesWithNative() immediately, so the mock that causes registerStories to throw must be set up before configure() is called — otherwise storiesRegistered is already true and the function returns early without hitting the warning path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
registerStoriesWithNative()was previously called insideStoryRenderer'suseEffect, which required the component to fully render andcreatePreparedStoryMapping()to complete beforestorybook_stories.jsonwas writtenconfigure(), which runs synchronously at JS bundle load time when_storyIndexis freshly populated bystart()useEffect(aftercreatePreparedStoryMapping()) for defense in depthTest plan
🤖 Generated with Claude Code