Experiment: blocking sync pull via awaitNextStory()#94
Open
EmilioBejasa wants to merge 5 commits intomainfrom
Open
Experiment: blocking sync pull via awaitNextStory()#94EmilioBejasa wants to merge 5 commits intomainfrom
EmilioBejasa wants to merge 5 commits intomainfrom
Conversation
…ries Instead of native emitting loadStory events, JS blocks itself via isBlockingSynchronousMethod awaitNextStory(). The test thread pushes story IDs into a LinkedBlockingQueue; JS unblocks, renders, calls notifyStoryReady(), then blocks again. One surface, no event emitter. NOTE: isBlockingSynchronousMethod is deprecated in new arch — this branch exists to test whether the approach works via the interop layer. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…read isBlockingSynchronousMethod is silently ignored in new arch bridgeless mode — the call returns undefined immediately, causing an infinite loop. Fix: awaitNextStory() is now a regular @ReactMethod(promise) that blocks on a background thread. JS uses await instead of a synchronous call. The LinkedBlockingQueue and push/await handshake are unchanged; only the bridge mechanism changes. Also apply buildPreparedStories() fix from experiment/js-driven-story-loop: access _preview.storyStoreValue directly to skip _preview.ready(), which never resolves when the Storybook UI isn't rendered. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3 tasks
LinkedBlockingQueue.put(null) throws NullPointerException. Replace the nullable queue with a String queue and map null to/from a DONE_SENTINEL so callers can still use pushStory(null) to signal completion. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Without an explicit measure/layout pass, Screenshot.snap(surface.view) captures a blank bitmap on Fabric. Mirror what the old arch path already does with ViewHelpers so the view tree is software-rendered and properly sized before capture. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ViewHelpers only sets software layer on the root view. Fabric child views retain hardware display lists which view.draw(canvas) cannot capture, producing blank (white background only) screenshots. Walk the full tree and set LAYER_TYPE_SOFTWARE on every node before snapping. 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
loadStoryevent emitter with a pull model: JS calls the synchronous native methodawaitNextStory(), which blocks the JS thread until the test runner enqueues the next story ID via aLinkedBlockingQueuenotifyStoryReady()(existing latch) still signals native after each renderHow it works
Known limitation
@ReactMethod(isBlockingSynchronousMethod = true)is deprecated in the new architecture. WithnewArchEnabled=truethis may not block —awaitNextStory()could returnundefinedvia the interop layer. This branch exists to test whether the approach works at all.Test plan
awaitNextStory()actually blocks the JS thread🤖 Generated with Claude Code