From 0ff6296d64930cf07170a1c14a9b99e26dd2584d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Mon, 18 May 2026 05:50:08 -0400 Subject: [PATCH] =?UTF-8?q?fix(core):=20remove=20late-bind=20polling=20fro?= =?UTF-8?q?m=20runtime=20=E2=80=94=20engine=20handles=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The setInterval-based late-bind polling in init.ts caused visual regressions across all style-prod tests. Even with the sawMissing guard, the mere presence of the interval registration altered event loop timing enough to shift rendered frames. The engine's pollSubCompositionTimelines + conditional __hfForceTimelineRebind already handles async timeline detection for renders. The runtime only needs to expose the rebind hook — it shouldn't poll on its own. For studio preview of async compositions, the engine's rebind call (via __hfForceTimelineRebind) is the correct mechanism. --- packages/core/src/runtime/init.ts | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/packages/core/src/runtime/init.ts b/packages/core/src/runtime/init.ts index 12007ed3c..01036dc84 100644 --- a/packages/core/src/runtime/init.ts +++ b/packages/core/src/runtime/init.ts @@ -1469,35 +1469,6 @@ export function initSandboxRuntimeModular(): void { applyCaptionOverrides(); postTimeline(); postState(true); - - let lateBindChecks = 0; - let sawMissing = false; - 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; - sawMissing = true; - break; - } - } - if (allBound && !sawMissing) { - 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