Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/studio/src/components/StudioPreviewArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,12 @@ export function StudioPreviewArea({
onCompositionChange={(compPath) => {
// Sync activeCompPath when user drills down via timeline double-click
// or navigates back via breadcrumb — keeps sidebar + thumbnails in sync.
setActiveCompPath(compPath);
refreshPreviewDocumentVersion();
// Guard against no-op updates to prevent circular refresh cascades
// between activeCompPath → compositionStack → onCompositionChange.
if (compPath !== activeCompPath) {
setActiveCompPath(compPath);
refreshPreviewDocumentVersion();
}
}}
onIframeRef={handlePreviewIframeRef}
previewOverlay={
Expand Down
7 changes: 5 additions & 2 deletions packages/studio/src/components/nle/NLELayout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { useState, useCallback, useRef, useEffect, memo, type ReactNode } from "react";
import { useMountEffect } from "../../hooks/useMountEffect";
import { useTimelinePlayer, PlayerControls, Timeline, usePlayerStore } from "../../player";
Expand Down Expand Up @@ -203,8 +203,11 @@
const updateCompositionStack: typeof setCompositionStack = useCallback((action) => {
setCompositionStack((prev) => {
const next = typeof action === "function" ? action(prev) : action;
const id = next[next.length - 1]?.id;
queueMicrotask(() => onCompositionChangeRef.current?.(id === "master" ? null : id));
const prevId = prev[prev.length - 1]?.id;
const nextId = next[next.length - 1]?.id;
if (prevId !== nextId) {
queueMicrotask(() => onCompositionChangeRef.current?.(nextId === "master" ? null : nextId));
}
return next;
});
}, []);
Expand Down
Loading