Skip to content

fix(studio): keep Code on the last composition selected - #7432

Open
AksharP5 wants to merge 1 commit into
heygen-com:mainfrom
AksharP5:source-selection
Open

AksharP5 wants to merge 1 commit into
heygen-com:mainfrom
AksharP5:source-selection

Conversation

@AksharP5

@AksharP5 AksharP5 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

What

Code stays on the last composition selected when source responses arrive out of order. Selecting groups.html and then index.html can otherwise leave the preview on index.html while a delayed response switches Code back to groups.html.

Why

The source editor can show and edit a different composition from the one being previewed. Obsolete failed requests can also show errors after a newer composition has loaded.

Related work

Fixes #7431

Searched open and closed issues/PRs by source editor, composition switching, stale responses, the loader symbol, and related work. The existing loading guard in #1964 and startup behavior in #4057 do not handle this response-order race.

How

Give each composition load an ID and invalidate it on project changes or unmount. Only the current load can publish source content or show an error. Current load failures still leave content unloaded and report the failure.

Before

Same fixture, browser, viewport, and response order: select groups.html, then index.html, then release the delayed groups.html response. Code selects groups.html; the preview still shows index.html.

Before: groups.html source beside the index.html preview

After

Code keeps index.html selected and shows its source beside the same index.html preview.

After: index.html source beside the index.html preview

Reproduction script, before result, after result.

Test plan

  • Seven focused regression cases: six fail on the baseline, all seven pass with the fix. Includes responses delayed before headers and during JSON parsing, stale errors, project changes, unmount, and current failures.
  • 32 tests pass across the loader, root auto-open, project reset, source save, and file-manager ownership suites.
  • Automated Chrome reproduction before and after; screenshots inspected; no page errors in either run.
  • oxlint, oxfmt, and fallow audit of changed files.
  • Browser editor documentation updated.
  • Full workspace build, patched Studio production build, Studio typecheck, and pre-commit core/Studio/script typechecks.
  • Full Mintlify validation/build, focused page validation, and broken-link checks.
  • Independent GPT-6 Astra review: no blocking findings for the Compositions-panel scope.

Vitest prints a teardown-timeout warning on both baseline and patched runs; the patched test command exits successfully. The fix covers requests initiated by the Compositions panel. File-tree and click-to-source loading paths retain their existing ownership behavior.

@mintlify

mintlify Bot commented Nov 9, 2026

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 36ebdb9.

Approve preview

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Studio Code can switch to an older composition after a delayed source response

1 participant