refactor(studio): drop the soft reload's reparse seeding, the held-element sweep covers it

This commit is contained in:
Miguel Angel Simon Sierra
2026-10-02 03:38:53 -07:00
parent d32b39c3e0
commit 0fa64b8aaf
3 changed files with 6 additions and 12 deletions
+2 -3
View File
@@ -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<string, string> | 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.
+3 -6
View File
@@ -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") {
@@ -48,10 +48,8 @@ export function collectResetTargets(
win: { __timelines?: Record<string, unknown> },
doc: Document,
targetKeys: string[],
reparse: Element[] = [],
): Map<Element, Set<string>> {
// Elements the caller needs GSAP to parse again, with nothing tweened yet.
const targets = new Map<Element, Set<string>>(reparse.map((el) => [el, new Set<string>()]));
const targets = new Map<Element, Set<string>>();
const timelines = (win.__timelines ?? {}) as Record<string, TweenLike | undefined>;
const others = new Set<unknown>(
Object.entries(timelines).flatMap(([key, tl]) => (targetKeys.includes(key) ? [] : [tl])),