Repository navigation
Description
Affected workflow
Switching compositions quickly can leave Code editing an older composition while the preview shows the latest selection. The composition source loader accepts every response, even after another composition has been selected.
Reproduced on main e351253724c7142cc4697de652f353a0fd74b66e (v0.9.26), Linux arm64, Bun 1.4.4 and Chrome 153.0.8010.36.
Reproduction
- Open a project containing two compositions and open the Code panel.
- Select the first composition while its
/api/projects/<project>/files/<composition>source request is delayed. - Select the second composition and let its source request finish.
- Let the first composition's request finish.
The browser reproduction uses the repository's ghost-lane fixture: select groups.html, then index.html, and release the held groups.html source request last. It drives the real Compositions and Code panels with Puppeteer and does not change the source responses.
Expected and actual
The preview and Code should stay on index.html. Instead, the preview still has composition root ghost-lane, but Code switches to groups.html, whose source title is Grouped track drop fixture. A subsequent source edit therefore targets a different composition from the one being previewed.
An obsolete failed request can also show an error after a newer composition has loaded successfully. Focused tests reproduce that behavior and responses accepted after project changes or unmount.
Evidence
Browser reproduction script and observed baseline result.
The cause is in packages/studio/src/hooks/useCompositionContentLoader.ts: the success and error callbacks have no request-ownership check. Current source loads must retain their loading placeholder and error reporting, while superseded loads must no longer update the editor or report errors.

Activity