fix(studio): export the composition the user has selected - #3550
Merged
Conversation
The header's Export button started renders with no options at all, so the request carried no `composition` and the server fell back to index.html. Selecting a sub-composition in the Comps panel showed its canvas and timeline but exported the root file instead. Studio starts renders from three controls, and the render target was owned by each of them separately: the Renders panel resolved it, the header omitted it, the sidebar's per-composition button named one explicitly. Give it one owner in `startRender`, which all three route through, defaulting to the active composition and leaving an explicit argument to win. Fixes #3549
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
Exporting from Studio now renders the composition the user currently has selected, instead of always falling back to
index.html.Why
Reported in #3549: in a project with a root
index.htmlplusparts/part-N.htmlsub-compositions, selecting a part in the Comps panel correctly showed that part's canvas and timeline, but clicking Export rendered the full-length root file.hyperframes render -c parts/part-1.htmlfrom the CLI produced the right file, so the gap was Studio-side only.The server already honours the request:
POST /api/projects/:id/renderreadsbody.composition, validates it resolves inside the project, and forwards it to the render adapter (packages/studio-server/src/routes/render.ts:93-101). It falls back toindex.htmlwhen the field is absent, which is the correct behaviour for a request that names nothing. No server change was needed.How
The render target had three owners, one per control that can start a render:
Only the middle one was wrong, but patching it would have left the same decision duplicated in two places, free to drift again. Instead the default now lives in
startRender, which all three controls route through, next to the FFmpeg gate that is there for the same reason:An explicit argument still wins, so the sidebar keeps rendering the card the user clicked rather than the one on screen. With nothing selected (master view) the field stays absent and the server's
index.htmlfallback still applies.useRenderQueuetakes the active composition as a ref so the target is read at click time without rebuilding every callback on each composition switch. The panel's now-redundant copy of the logic is deleted.No composition picker was added: defaulting to the active composition is the fix, and a picker would be new surface for a problem the selection already answers.
Test plan
Unit — new
useRenderQueueComposition.test.tsxasserts the POST body directly: it carries the active composition when the caller names none, keeps an explicit argument when one is given, and omits the field entirely when nothing is selected. Verified non-vacuous by reverting the one-line default, which fails the first case withexpected undefined to be 'parts/part-1.html'.Full package suite:
bun run --filter @hyperframes/studio test→ 409 files, 4553 tests passing.End to end — scaffolded a project matching the report's shape (root
index.htmlat 20s,parts/part-1.htmlat 4s), ran the realpreviewserver against it, drove Studio in Puppeteer, selectedparts/part-1in the Comps panel, clicked the header's Export, and let the render finish.Before, with the default removed:
After:
Fixes #3549