fix: activate nested child timelines during renderSeek

The renderSeek override in init.ts called seekTimelineAndAdapters() which
only did rootTimeline.totalTime(t) without activating child timelines.
GSAP does not propagate totalTime() to internally paused children.

Also simplifies pollSubCompositionTimelines to always call rebind when
timelines are ready, removing the before/after count comparison that
could skip the rebind on fast page loads.
This commit is contained in:
Miguel Ángel
2026-05-19 15:42:07 -04:00
parent 29ad7df90c
commit 0d12a465a3
4 changed files with 195 additions and 9 deletions
+8 -7
View File
@@ -365,14 +365,15 @@ async function pollSubCompositionTimelines(
}
return true;
})()`;
const timelinesBeforePoll = Number(
await page.evaluate(`Object.keys(window.__timelines || {}).length`),
);
const ready = await pollPageExpression(page, expression, timeoutMs, intervalMs);
const timelinesAfterPoll = Number(
await page.evaluate(`Object.keys(window.__timelines || {}).length`),
);
if (ready && timelinesAfterPoll > timelinesBeforePoll) {
// Always force a timeline rebind once sub-composition timelines are
// confirmed present. The previous implementation only called rebind
// when the timeline count grew during the poll, which missed the case
// where all sub-comp scripts had already executed before the poll
// started — leaving child timelines un-nested in the root and causing
// the earliest sub-composition (data-start near 0) to render without
// its GSAP animations.
if (ready) {
await page.evaluate(`(function() {
if (typeof window.__hfForceTimelineRebind === "function") {
window.__hfForceTimelineRebind();