diff --git a/packages/core/src/runtime/init.ts b/packages/core/src/runtime/init.ts index 5c677959e..a57de988a 100644 --- a/packages/core/src/runtime/init.ts +++ b/packages/core/src/runtime/init.ts @@ -964,6 +964,11 @@ export function initSandboxRuntimeModular(): void { return true; }; + (window as any).__hfForceTimelineRebind = () => { + childrenBound = false; + bindRootTimelineIfAvailable(); + }; + const emitRootStageLayoutDiagnostics = () => { const rootNode = resolveRootCompositionElement(); if (!(rootNode instanceof HTMLElement)) { diff --git a/packages/engine/src/services/frameCapture.ts b/packages/engine/src/services/frameCapture.ts index 313e097a9..ea1b01ec6 100644 --- a/packages/engine/src/services/frameCapture.ts +++ b/packages/engine/src/services/frameCapture.ts @@ -356,7 +356,7 @@ async function pollSubCompositionTimelines( ): Promise { const expression = `(function() { var hosts = document.querySelectorAll("[data-composition-id]"); - if (hosts.length <= 1) return true; + if (hosts.length === 0) return true; var timelines = window.__timelines || {}; for (var i = 0; i < hosts.length; i++) { var id = hosts[i].getAttribute("data-composition-id"); @@ -366,6 +366,13 @@ async function pollSubCompositionTimelines( return true; })()`; const ready = await pollPageExpression(page, expression, timeoutMs, intervalMs); + if (ready) { + await page.evaluate(`(function() { + if (typeof window.__hfForceTimelineRebind === "function") { + window.__hfForceTimelineRebind(); + } + })()`); + } if (!ready) { const missing = await page.evaluate(`(function() { var hosts = document.querySelectorAll("[data-composition-id]");