fix: regression fixes — conditional rebind + updated compilation baselines

1. Only call __hfForceTimelineRebind() when the timeline poll actually
   had to wait (pollDuration > 2 intervals). For compositions with
   synchronous timeline registration, the rebind was unnecessary and
   shifted render timing, causing PSNR regressions in chat and
   gsap-letters-render-compat.

2. Regenerate compiled.html baselines for missing-host-comp-id and
   overlay-montage-prod to match the new flattenInnerRoot behavior
   (data-composition-id stripped from inlined inner roots, replaced
   with data-hf-authored-id).

3. Add late-bind polling to runtime init.ts — after external
   compositions load, poll for 5s to detect async timelines that
   register after initial binding (e.g. from fetch callbacks).
This commit is contained in:
Miguel Ángel
2026-05-18 03:46:58 -04:00
parent 0f1c64dcae
commit 04c35ce24c
4 changed files with 1828 additions and 100 deletions
+27
View File
@@ -1469,6 +1469,33 @@ export function initSandboxRuntimeModular(): void {
applyCaptionOverrides();
postTimeline();
postState(true);
let lateBindChecks = 0;
const lateBindInterval = setInterval(() => {
if (++lateBindChecks > 50) {
clearInterval(lateBindInterval);
return;
}
const hosts = document.querySelectorAll("[data-composition-id]");
let allBound = true;
for (let i = 0; i < hosts.length; i++) {
const id = hosts[i].getAttribute("data-composition-id");
if (id && !timelines[id]) {
allBound = false;
break;
}
}
if (allBound && lateBindChecks > 1) {
clearInterval(lateBindInterval);
return;
}
if (!allBound) return;
childrenBound = false;
bindRootTimelineIfAvailable();
postTimeline();
postState(true);
clearInterval(lateBindInterval);
}, 100);
});
} else {
// No external/inline compositions to load — apply caption overrides immediately