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
+6 -3
View File
@@ -1463,7 +1463,9 @@ export function initSandboxRuntimeModular(): void {
.finally(() => {
externalCompositionsReady = true;
bindRootTimelineIfAvailable();
(window as Window & { __renderReady?: boolean }).__renderReady = true;
if (state.capturedTimeline) {
(window as Window & { __renderReady?: boolean }).__renderReady = true;
}
runAdapters("discover", state.currentTime);
bindMediaMetadataListeners();
installAssetFailureDiagnostics();
@@ -1650,9 +1652,10 @@ export function initSandboxRuntimeModular(): void {
if (bindRootTimelineIfAvailable() && state.capturedTimeline !== prevTimeline) {
player._timeline = state.capturedTimeline;
}
// Re-run adapters to discover new elements
runAdapters("discover", state.currentTime);
(window as Window & { __renderReady?: boolean }).__renderReady = true;
if (state.capturedTimeline) {
(window as Window & { __renderReady?: boolean }).__renderReady = true;
}
postTimeline();
postState(true);
}, 0);