Skip to content

Commit ed9ffa5

Browse files
vanceingallsclaude
andcommitted
fix(core): type the playback visibility skip for any element, and cache clip layout only once loaded
The skip's predicate took an HTMLElement where the pass hands it a StylableElement (tsconfig.runtime.json). The layout cache records a clip only once the document has loaded, so a pass before stylesheets apply is redone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 20f057c commit ed9ffa5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎packages/core/src/runtime/init.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,9 @@ export function initSandboxRuntimeModular(): void {
971971
for (const { el, priority } of displayNoneLiftedToMeasureShown) {
972972
el.style.setProperty("display", "none", priority);
973973
}
974-
for (const el of clips) clipLayoutInputs.set(el, clipLayoutKey(el));
974+
// Not while the page loads: a pass before its stylesheets apply reads computed sizes they will change.
975+
if (document.readyState === "complete")
976+
for (const el of clips) clipLayoutInputs.set(el, clipLayoutKey(el));
975977
};
976978

977979
const createTimingResolver = (includeAuthoredTimingAttrs: boolean) =>
@@ -2907,7 +2909,7 @@ export function initSandboxRuntimeModular(): void {
29072909
from: number,
29082910
to: number,
29092911
rootComp: HTMLElement | null,
2910-
): ((node: HTMLElement) => boolean) | null => {
2912+
): ((node: Element) => boolean) | null => {
29112913
if (!rootComp || !(Math.abs(to - from) <= PLAYED_STEP_MAX_SECONDS)) return null;
29122914
const index = resolveMediaClipIndex();
29132915
let windows = mediaWindows.get(index);

0 commit comments

Comments
 (0)