From 1e9a1757788986c23e79d39db69db7a59f225c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Thu, 21 May 2026 12:45:30 -0400 Subject: [PATCH] fix(studio): preserve playhead position on composition refresh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stop NLEPreview from including refreshKey in the Player's React key. Previously, a refreshKey change caused a full Player teardown + remount, which destroyed the playback adapter before refreshPlayer() could save the seek position — so the playhead always reset to 0:00. Now refreshKey changes only trigger refreshPlayer()'s lightweight iframe.src reload path, which correctly captures the current time via saveSeekPosition() before reloading the iframe content. Closes #996 --- packages/studio/src/components/nle/NLEPreview.tsx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/studio/src/components/nle/NLEPreview.tsx b/packages/studio/src/components/nle/NLEPreview.tsx index 8b51d8852..ebb3b95f5 100644 --- a/packages/studio/src/components/nle/NLEPreview.tsx +++ b/packages/studio/src/components/nle/NLEPreview.tsx @@ -95,7 +95,6 @@ export const NLEPreview = memo(function NLEPreview({ suppressLoadingOverlay, }: NLEPreviewProps) { const baseKey = getPreviewPlayerKey({ projectId, directUrl, refreshKey }); - const prevRefreshKeyRef = useRef(refreshKey); const viewportRef = useRef(null); const stageRef = useRef(null); const [retiringKey, setRetiringKey] = useState(null); @@ -205,13 +204,7 @@ export const NLEPreview = memo(function NLEPreview({ [applyTransform], ); - if (refreshKey !== prevRefreshKeyRef.current) { - const oldKey = `${baseKey}:${prevRefreshKeyRef.current ?? 0}`; - prevRefreshKeyRef.current = refreshKey; - setRetiringKey(oldKey); - } - - const activeKey = `${baseKey}:${refreshKey ?? 0}`; + const activeKey = baseKey; const applyInitialZoom = useCallback(() => { const z = zoomRef.current;