Skip to content

Single surface + loadStory for screenshot loop#93

Draft
EmilioBejasa wants to merge 2 commits intomainfrom
fix/single-surface-load-story
Draft

Single surface + loadStory for screenshot loop#93
EmilioBejasa wants to merge 2 commits intomainfrom
fix/single-surface-load-story

Conversation

@EmilioBejasa
Copy link
Copy Markdown
Collaborator

Summary

  • Mount one ReactSurface for the entire test run instead of remounting per story
  • After bootstrap populates _idToPrepared, switch stories via loadStory() events fired on the main thread
  • Fix loadStory emission: replace getJSModule(RCTDeviceEventEmitter) (bridge-era API, returns null in bridgeless/new-arch) with reactApplicationContext.emitDeviceEvent(), which is what RN's own internals use

Test plan

  • Run screenshot tests and verify all stories render (not "Loading story...")
  • Check CI passes on this branch

🤖 Generated with Claude Code

EmilioBejasa and others added 2 commits March 26, 2026 13:17
Instead of remounting a fresh ReactSurface for every story, keep one
surface alive for the entire test run. After the bootstrap render
populates the story manifest and _idToPrepared, each story is switched
by emitting a loadStory event from the main thread and waiting on a
CountDownLatch that notifyStoryReady() releases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
getJSModule(RCTDeviceEventEmitter) is a bridge-era API that returns null
in bridgeless/new-arch mode, silently dropping the event. emitDeviceEvent
is the current API used by RN's own DeviceEventManagerModule internals.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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