From 0fa64b8aafaf5342f63c77ef12fe198e8aaae431 Mon Sep 17 00:00:00 2001 From: Miguel Angel Simon Sierra Date: Thu, 1 Oct 2026 23:55:25 -0700 Subject: [PATCH] refactor(studio): drop the soft reload's reparse seeding, the held-element sweep covers it --- packages/studio/src/utils/gsapSoftReload.ts | 5 ++--- packages/studio/src/utils/gsapUndoRestore.ts | 9 +++------ packages/studio/src/utils/softReloadTargets.ts | 4 +--- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/packages/studio/src/utils/gsapSoftReload.ts b/packages/studio/src/utils/gsapSoftReload.ts index 5c94e3931e..405d9d764d 100644 --- a/packages/studio/src/utils/gsapSoftReload.ts +++ b/packages/studio/src/utils/gsapSoftReload.ts @@ -209,7 +209,6 @@ export interface SoftReloadOptions { currentTimeOverride?: number; /** After-write file HTML — the primary source for the authored opacity and transform restore. */ authoredHtml?: string; - reparse?: Element[]; /** Other composition files a reset element is written in, by path; null when one could not be read. */ nestedFiles?: Map | null; } @@ -274,7 +273,7 @@ export function applySoftReload( scriptText: string, options: SoftReloadOptions = {}, ): SoftReloadResult { - const { onAsyncFailure, currentTimeOverride, authoredHtml, reparse = [] } = options; + const { onAsyncFailure, currentTimeOverride, authoredHtml } = options; if (!iframe || !scriptText) return "cannot-soft-reload"; const win = iframe.contentWindow as IframeWindow | null; @@ -347,7 +346,7 @@ export function applySoftReload( // fallow-ignore-next-line complexity const doReload = () => { const timelines = win.__timelines; - const targets = collectResetTargets(win, doc, targetKeys, reparse); + const targets = collectResetTargets(win, doc, targetKeys); // Kill ONLY the target composition's timeline(s) — leaving every other // composition's timeline (and its children on the global timeline) intact. diff --git a/packages/studio/src/utils/gsapUndoRestore.ts b/packages/studio/src/utils/gsapUndoRestore.ts index 04513d5d0e..5814a59afc 100644 --- a/packages/studio/src/utils/gsapUndoRestore.ts +++ b/packages/studio/src/utils/gsapUndoRestore.ts @@ -398,20 +398,17 @@ export function applyUndoRestoreToPreview( const active = files[activeDocPath]; const restoredScript = active ? extractGsapScriptText(active.restored) : null; const previousScript = active ? extractGsapScriptText(active.previous) : null; - const reparse = plan.scripted - ? plan.targets.map(({ live }) => live).filter((el) => "_gsap" in el) - : []; - if (reparse.length && !restoredScript) { + const reparse = plan.scripted && plan.targets.some(({ live }) => "_gsap" in live); + if (reparse && !restoredScript) { reloadPreview(); return "full"; } - if (restoredScript && (restoredScript !== previousScript || reparse.length)) { + if (restoredScript && (restoredScript !== previousScript || reparse)) { syncStaleEditMarks(doc, active); const result = applySoftReload(iframe, restoredScript, { onAsyncFailure: reloadPreview, currentTimeOverride: currentTime, authoredHtml: active.restored, - reparse, nestedFiles, }); if (result === "cannot-soft-reload") { diff --git a/packages/studio/src/utils/softReloadTargets.ts b/packages/studio/src/utils/softReloadTargets.ts index 46bdd9c7b7..836ba25939 100644 --- a/packages/studio/src/utils/softReloadTargets.ts +++ b/packages/studio/src/utils/softReloadTargets.ts @@ -48,10 +48,8 @@ export function collectResetTargets( win: { __timelines?: Record }, doc: Document, targetKeys: string[], - reparse: Element[] = [], ): Map> { - // Elements the caller needs GSAP to parse again, with nothing tweened yet. - const targets = new Map>(reparse.map((el) => [el, new Set()])); + const targets = new Map>(); const timelines = (win.__timelines ?? {}) as Record; const others = new Set( Object.entries(timelines).flatMap(([key, tl]) => (targetKeys.includes(key) ? [] : [tl])),