Skip to content

Commit 5e99fc7

Browse files
committed
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 heygen-com#996
1 parent da568ac commit 5e99fc7

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

‎packages/studio/src/components/nle/NLEPreview.tsx‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ export const NLEPreview = memo(function NLEPreview({
9595
suppressLoadingOverlay,
9696
}: NLEPreviewProps) {
9797
const baseKey = getPreviewPlayerKey({ projectId, directUrl, refreshKey });
98-
const prevRefreshKeyRef = useRef(refreshKey);
9998
const viewportRef = useRef<HTMLDivElement>(null);
10099
const stageRef = useRef<HTMLDivElement>(null);
101100
const [retiringKey, setRetiringKey] = useState<string | null>(null);
@@ -205,13 +204,7 @@ export const NLEPreview = memo(function NLEPreview({
205204
[applyTransform],
206205
);
207206

208-
if (refreshKey !== prevRefreshKeyRef.current) {
209-
const oldKey = `${baseKey}:${prevRefreshKeyRef.current ?? 0}`;
210-
prevRefreshKeyRef.current = refreshKey;
211-
setRetiringKey(oldKey);
212-
}
213-
214-
const activeKey = `${baseKey}:${refreshKey ?? 0}`;
207+
const activeKey = baseKey;
215208

216209
const applyInitialZoom = useCallback(() => {
217210
const z = zoomRef.current;

0 commit comments

Comments
 (0)