Skip to content

fix(studio): prevent composition switch loop on sub-composition navigation#754

Merged
miguel-heygen merged 1 commit into
mainfrom
fix/studio-composition-switch-loop
May 12, 2026
Merged

fix(studio): prevent composition switch loop on sub-composition navigation#754
miguel-heygen merged 1 commit into
mainfrom
fix/studio-composition-switch-loop

Conversation

@vanceingalls
Copy link
Copy Markdown
Collaborator

Summary

Circular state update between activeCompPath and compositionStack caused the preview to flicker when navigating to sub-compositions and scrubbing.

The cycle: activeCompPath change → useEffect updates compositionStackonCompositionChange fires → setActiveCompPath + refreshPreviewDocumentVersion → re-render → effect re-evaluates → repeat.

Fix: Guard both sides of the cycle:

  1. onCompositionChange in StudioPreviewArea skips if compPath === activeCompPath
  2. updateCompositionStack in NLELayout skips onCompositionChange notification if top-of-stack ID unchanged

Test plan

  • Open a composition with sub-compositions (e.g., captions loaded via data-composition-src)
  • Click into the sub-composition in the sidebar or timeline
  • Scrub the timeline — preview should NOT flicker or reload
  • Navigate back to master — should work without flicker
  • Double-click a sub-composition clip in timeline to drill down — should work normally

🤖 Generated with Claude Code

…ation

Circular state update between activeCompPath and compositionStack caused
the preview to flicker when navigating to sub-compositions and scrubbing.
The cycle: activeCompPath change → useEffect updates compositionStack →
onCompositionChange fires → setActiveCompPath + refreshPreviewDocumentVersion
→ re-render → effect re-evaluates → repeat. Fixed by guarding both sides:
onCompositionChange skips if path unchanged, updateCompositionStack skips
notification if top-of-stack ID unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@miguel-heygen miguel-heygen merged commit 59e1d07 into main May 12, 2026
26 of 29 checks passed
@miguel-heygen miguel-heygen deleted the fix/studio-composition-switch-loop branch May 12, 2026 21:51
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.

2 participants