fix(core,cli): address review — guard __renderReady, drop pre-quantization, add tests

- Guard __renderReady with `if (state.capturedTimeline)` in all three
  paths (setTimeout(0) and .finally() were setting it unconditionally
  even when bindRootTimelineIfAvailable returned false)
- Remove redundant fps=30 pre-quantization in snapshot — renderSeek
  already calls quantizeTimeToFrame internally with the runtime's
  canonicalFps, so pre-quantizing was double-quantizing at a
  potentially wrong grid
- Add regression tests: __renderReady is set when timeline exists,
  stays undefined when no timeline is available
This commit is contained in:
Miguel Ángel
2026-05-24 13:31:36 -04:00
parent 16e049b320
commit e7d0b392c7
3 changed files with 56 additions and 8 deletions
+2 -5
View File
@@ -276,17 +276,14 @@ async function captureSnapshots(
for (let i = 0; i < positions.length; i++) {
const time = positions[i]!;
// 30 = runtime's default canonicalFps (not exposed on PlayerAPI)
await page.evaluate((t: number) => {
const player = (window as any).__player;
if (!player) return;
const safe = Math.max(0, Number(t) || 0);
const frame = Math.floor(safe * 30 + 1e-9);
const quantized = frame / 30;
if (typeof player.renderSeek === "function") {
player.renderSeek(quantized);
player.renderSeek(safe);
} else if (typeof player.seek === "function") {
player.seek(quantized);
player.seek(safe);
}
if ((window as any).gsap?.ticker?.tick) {
(window as any).gsap.ticker.tick();