Skip to content

Write HTML. Render video. Built for agents.

refactor(core): apply /simplify findings on sub-comp scoping PR

James1da6f456b719
diff --git a/packages/core/src/compiler/compositionScoping.test.ts b/packages/core/src/compiler/compositionScoping.test.ts
index 1c01100c08..4c1a0189bf 100644
--- a/packages/core/src/compiler/compositionScoping.test.ts
+++ b/packages/core/src/compiler/compositionScoping.test.ts
@@ -64,7 +64,6 @@ body { margin: 0; }
getVariables: () => ({ title: "TOP-LEVEL-LEAK" }),
fitTextFontSize: () => undefined,
},
- __captured: undefined as unknown,
};
const wrapped = wrapScopedCompositionScript(
`window.__captured = __hyperframes.getVariables();`,
@@ -85,7 +84,6 @@ body { margin: 0; }
getVariables: () => ({ title: "TOP-LEVEL-LEAK" }),
fitTextFontSize: () => undefined,
},
- __captured: undefined as unknown,
};
const wrapped = wrapScopedCompositionScript(
`window.__captured = __hyperframes.getVariables();`,
diff --git a/packages/core/src/runtime/compositionLoader.ts b/packages/core/src/runtime/compositionLoader.ts
index 6c87119a7e..f69d6fa392 100644
--- a/packages/core/src/runtime/compositionLoader.ts
+++ b/packages/core/src/runtime/compositionLoader.ts
@@ -244,11 +244,8 @@ async function mountCompositionContent(params: {
...parseHostVariableValues(params.host),
};
if (Object.keys(merged).length > 0) {
- const w = window as Window & {
- __hfVariablesByComp?: Record<string, Record<string, unknown>>;
- };
- if (!w.__hfVariablesByComp) w.__hfVariablesByComp = {};
- w.__hfVariablesByComp[scopeCompositionId] = merged;
+ if (!window.__hfVariablesByComp) window.__hfVariablesByComp = {};
+ window.__hfVariablesByComp[scopeCompositionId] = merged;
}
}