Skip to content

Register stories at configure() time to fix bootstrap#62

Open
EmilioBejasa wants to merge 3 commits intomainfrom
fix/register-stories-at-configure
Open

Register stories at configure() time to fix bootstrap#62
EmilioBejasa wants to merge 3 commits intomainfrom
fix/register-stories-at-configure

Conversation

@EmilioBejasa
Copy link
Copy Markdown
Collaborator

Summary

  • registerStoriesWithNative() was previously called inside StoryRenderer's useEffect, which required the component to fully render and createPreparedStoryMapping() to complete before storybook_stories.json was written
  • This made the bootstrap phase unreliable — if either step took too long or failed, the 10-second timeout would expire and the test would fail with "Stories manifest not found"
  • 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

Test plan

  • Run the Android screenshot tests — the "Stories manifest not found. Bootstrap failed." error should no longer appear
  • Create a draft PR to verify CI passes

🤖 Generated with Claude Code

EmilioBejasa and others added 3 commits March 3, 2026 17:35
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>
@EmilioBejasa EmilioBejasa requested a review from tdrhq March 4, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant