Skip to content

Write HTML. Render video. Built for agents.

fix(core): guard element stamping to iframe-only (Studio preview)

Miguel Ángel192417b7cd73
diff --git a/packages/core/src/runtime/init.ts b/packages/core/src/runtime/init.ts
index 9486d56381..10c9bee9a9 100644
--- a/packages/core/src/runtime/init.ts
+++ b/packages/core/src/runtime/init.ts
@@ -982,7 +982,9 @@ export function initSandboxRuntimeModular(): void {
});
// Stamp data-start / data-duration on GSAP-targeted elements that lack
// them so the Studio timeline can discover individual animated elements.
- {
+ // Only when embedded in an iframe (Studio preview) — production renders
+ // run as the top-level page and must not mutate element timing.
+ if (window.parent !== window) {
const rootComp = resolveRootCompositionElement();
const rootDuration = boundDuration > 0 ? boundDuration : 0;
const dur = String(rootDuration > 0 ? rootDuration : 1);