Skip to content

Open the document the Studio hands over, not the previous one - #3

Merged
dallasbpeters merged 1 commit into
mainfrom
rolemodel/studio-in-app
Aug 24, 2026
Merged

Open the document the Studio hands over, not the previous one#3
dallasbpeters merged 1 commit into
mainfrom
rolemodel/studio-in-app

Conversation

@dallasbpeters

Copy link
Copy Markdown
Member

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 the else branch of Preview'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, and mountEditorInto hands over anything that changed.

Fix

The loader moves to useOpenProjectFile, and the subscription is mounted by NewEditorShell, 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.

vitest on the two touched files passes (8), typecheck is clean, biome is clean. The 32 failures elsewhere in src/components/ai-edition/ are pre-existing — localStorage undefined in the node test env, in code this PR does not touch.

🤖 Generated with Claude Code

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>
@dallasbpeters
dallasbpeters merged commit 8dd630c into main Aug 24, 2026
13 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant