fix(studio): preserve playhead position on composition refresh

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
This commit is contained in:
Miguel Ángel
2026-05-21 12:45:30 -04:00
parent 90a4e4b1c5
commit 1e9a175778
@@ -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<HTMLDivElement>(null);
const stageRef = useRef<HTMLDivElement>(null);
const [retiringKey, setRetiringKey] = useState<string | null>(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;