experiment: eager story prep at configure() time#96
Open
EmilioBejasa wants to merge 3 commits intomainfrom
Open
experiment: eager story prep at configure() time#96EmilioBejasa wants to merge 3 commits intomainfrom
EmilioBejasa wants to merge 3 commits intomainfrom
Conversation
Kicks off loadStory() for all stories immediately in configure(), using _preview.storyStoreValue directly (bypasses _preview.ready() which only resolves when the Storybook UI renders — never in a test run). By the time StoryRenderer mounts, _idToPrepared is already fully populated, so the render effect is synchronous (no await in the hot path). Combined with the JS-driven Promise handshake from the previous experiment, this removes all async work between "set story" and "notify native ready". 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>
view.draw(canvas) skips Fabric child views that have hardware display lists, leaving only the root container's white background. Walking the entire view tree and setting LAYER_TYPE_SOFTWARE on every node ensures all content is visible to the software canvas used by Screenshot.snap(). 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.
What
Third experimental approach for the JS-driven story loop.
Key insight:
configure(view)is called synchronously during app startup, when_preview.storyStoreValueis already set.importFnisasync path => importMap[path]— the map is eagerly loaded, so eachloadStory()call resolves in one microtask. We can fan-out allloadStory()calls inconfigure()and store the resulting Promise.By the time
StoryRenderermounts (much later, after the full app has initialised),eagerPrepPromiseis already resolved. Theawaitin the init effect is effectively a no-op.Approach
createPreparedStoryMapping()per storybuildPreparedStories()in init effectloadStory()fan-out inconfigure()The native side (
StorybookRegistry.kt,BaseStoryScreenshotTest.kt) is the same Promise handshake protocol as #95:prepareForNextStory()→ arms latchnotifyStoryReady(id, promise)→ stores promise, counts down latchresolveCurrentStory()→ resolves JS PromiseallStoriesDone()→ test loop exitsTest plan
🤖 Generated with Claude Code