From a7330da47bef8ff9a00659c389c8ff9dee855e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Fri, 7 Aug 2026 20:47:53 +0000 Subject: [PATCH] fix(core): stop dropping a mounted composition's styles and scripts A composition mounted as a sub-composition lost its entire stylesheet and scripts whenever they were authored as siblings of the composition root inside its template. mountCompositionContent collected assets from the composition root element, so sibling nodes were invisible to it. The shape is legal and common, so the result was three catalog components rendering completely unstyled in live preview. oversized-cursor drew its pointer at 1280px against an authored 7cqw, roughly 134px at 1920, because width: 7cqw was never declared at all -- the whole stylesheet was missing. Confirmed in the mounted document, where only the host's own style element was present. Collect from the source node, which is a superset of the root and the single point every mount path routes through: external fetch, inline template, nested. Strip the mounted clone rather than the source. The previous code removed the extracted nodes from the node it was given, which on the inline-template path is a live template still in the document -- a remount would have found it emptied. Why nothing caught it: every CLI gate reaches the compiler path through bundleToSingleHtml, and the compiler always collected from the whole template. Nothing in the CLI exercises the mount path, which is reachable only through the player and Studio. So the rendered video was correct the entire time and only the preview was wrong. A test spanning both paths lands separately. The regression test fails on the pre-fix code, asserting that the mounted document contains the composition's own container-type declaration and finding an empty string instead -- the stylesheet that never arrived -- and passes after. Verified in both directions rather than assumed. --- .../src/runtime/compositionLoader.test.ts | 37 ++++++ .../core/src/runtime/compositionLoader.ts | 107 ++++++++---------- 2 files changed, 84 insertions(+), 60 deletions(-) diff --git a/packages/core/src/runtime/compositionLoader.test.ts b/packages/core/src/runtime/compositionLoader.test.ts index 347de964e..0b3424c44 100644 --- a/packages/core/src/runtime/compositionLoader.test.ts +++ b/packages/core/src/runtime/compositionLoader.test.ts @@ -90,6 +90,43 @@ describe("loadExternalCompositions", () => { expect(injectedStyles.length).toBeGreaterThan(0); }); + it("mounts +

Scene

+