Open the document the Studio hands over, not the previous one - #3
Merged
Conversation
Clicking a video in the Studio opened whatever the editor already had. A freshly drafted HyperFrames deck loaded the Feeney video; opening the openscreen project loaded the deck. The hand-over subscription lived in EditorEmptyState, which is exactly the component that unmounts once a document is open — it renders in the `else` branch of Preview's "is there media" test. So the first hand-over worked and every one after it landed on a dead listener, leaving the editor showing the document before. The Studio side was right: it sets `editorDoc`, navigates, and mountEditorInto hands over anything that changed. Move the loader into useOpenProjectFile and mount the subscription in NewEditorShell, which lives for the window. The empty state keeps using the loader for its own drop and file-picker paths. No test ever covered the arrival routes, which is how this shipped: the new one pushes two documents in a row and asserts the second is the one that opens. Co-Authored-By: Claude Opus 5 <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.
Clicking a video in the Studio opened whatever the editor already had — a freshly drafted HyperFrames deck loaded the Feeney video, and opening the openscreen project loaded the deck.
Cause
The hand-over subscription lived in
EditorEmptyState, which is the component that unmounts once a document is open: it renders in theelsebranch ofPreview's "is there media" test. The first hand-over worked, and every one after it landed on a dead listener.The Studio side was correct all along — it sets
editorDoc, navigates, andmountEditorIntohands over anything that changed.Fix
The loader moves to
useOpenProjectFile, and the subscription is mounted byNewEditorShell, which lives for the window. The empty state keeps using the loader for its own drop and file-picker paths.Tests
No test ever covered the arrival routes, which is how this shipped. The new one pushes two documents in a row and asserts the second is the one that opens, plus the parked-at-launch path.
viteston the two touched files passes (8), typecheck is clean, biome is clean. The 32 failures elsewhere insrc/components/ai-edition/are pre-existing —localStorageundefined in the node test env, in code this PR does not touch.🤖 Generated with Claude Code