🎥 Make videos programmatically with React
`@remotion/studio-server`: Validate sequence prop component identity
Jonny Burgerfee1709b0656
diff --git a/packages/core/src/CompositionManager.tsx b/packages/core/src/CompositionManager.tsxindex 60ace68eb4..2221df4570 100644--- a/packages/core/src/CompositionManager.tsx+++ b/packages/core/src/CompositionManager.tsx@@ -95,11 +95,14 @@ export type LoopDisplay = {durationInFrames: number;};+export type JsxComponentIdentity = string;+export type SequenceControls = {schema: SequenceSchema;currentRuntimeValueDotNotation: Record<string, unknown>;overrideId: string;supportsEffects: boolean;+ componentIdentity: JsxComponentIdentity | null;};export type TSequence = {diff --git a/packages/core/src/HtmlInCanvas.tsx b/packages/core/src/HtmlInCanvas.tsxindex fc85cbbaa8..db7a296bfc 100644--- a/packages/core/src/HtmlInCanvas.tsx+++ b/packages/core/src/HtmlInCanvas.tsx@@ -705,6 +705,7 @@ const htmlInCanvasSchema = {const HtmlInCanvasWrapped = wrapInSchema({Component: HtmlInCanvasInner,+ componentIdentity: 'dev.remotion.remotion.HtmlInCanvas',schema: htmlInCanvasSchema,supportsEffects: true,});diff --git a/packages/core/src/Img.tsx b/packages/core/src/Img.tsxindex fb2cb98f56..7976ab29d2 100644--- a/packages/core/src/Img.tsx+++ b/packages/core/src/Img.tsx@@ -549,6 +549,7 @@ const ImgInner: React.FC<*/export const Img = wrapInSchema({Component: ImgInner,+ componentIdentity: 'dev.remotion.remotion.Img',schema: imgSchema,supportsEffects: true,});diff --git a/packages/core/src/Interactive.tsx b/packages/core/src/Interactive.tsxindex d753f4ad0c..90ddf75e78 100644--- a/packages/core/src/Interactive.tsx+++ b/packages/core/src/Interactive.tsx@@ -162,6 +162,7 @@ const makeInteractiveElement = <Tag extends InteractiveTag>(const Wrapped = wrapInSchema({Component: Inner,+ componentIdentity: `dev.remotion.remotion.${displayName.slice(1, -1)}`,schema: interactiveElementSchema,supportsEffects: false,}) as InteractiveElementComponent<Tag>;diff --git a/packages/core/src/Sequence.tsx b/packages/core/src/Sequence.tsxindex 17d5e69e0e..4d2e6e934f 100644--- a/packages/core/src/Sequence.tsx+++ b/packages/core/src/Sequence.tsx@@ -554,12 +554,14 @@ export const SequenceWithoutSchema = SequenceInner;*/export const Sequence = wrapInSchema({Component: SequenceInner,+ componentIdentity: 'dev.remotion.remotion.Sequence',schema: sequenceSchema,supportsEffects: false,});export const SequenceWithoutFrom = wrapInSchema({Component: SequenceInner,+ componentIdentity: null,schema: sequenceSchemaWithoutFrom,supportsEffects: false,});diff --git a/packages/core/src/animated-image/AnimatedImage.tsx b/packages/core/src/animated-image/AnimatedImage.tsxindex e8871d66f4..53586742fd 100644--- a/packages/core/src/animated-image/AnimatedImage.tsx+++ b/packages/core/src/animated-image/AnimatedImage.tsx@@ -296,6 +296,7 @@ const AnimatedImageInner = ({export const AnimatedImage = wrapInSchema({Component: AnimatedImageInner,+ componentIdentity: 'dev.remotion.remotion.AnimatedImage',schema: animatedImageSchema,supportsEffects: true,});diff --git a/packages/core/src/canvas-image/CanvasImage.tsx b/packages/core/src/canvas-image/CanvasImage.tsxindex ed5bd82eb1..d6d2a2b47c 100644--- a/packages/core/src/canvas-image/CanvasImage.tsx+++ b/packages/core/src/canvas-image/CanvasImage.tsx@@ -484,6 +484,7 @@ const CanvasImageInner = forwardRef<*/export const CanvasImage = wrapInSchema({Component: CanvasImageInner,+ componentIdentity: 'dev.remotion.remotion.CanvasImage',schema: canvasImageSchema,supportsEffects: true,});diff --git a/packages/core/src/effects/Solid.tsx b/packages/core/src/effects/Solid.tsxindex 6dcc1f6558..88ab2edcfa 100644--- a/packages/core/src/effects/Solid.tsx+++ b/packages/core/src/effects/Solid.tsx@@ -303,6 +303,7 @@ const SolidOuter = forwardRef<export const Solid = wrapInSchema({Component: SolidOuter,+ componentIdentity: 'dev.remotion.remotion.Solid',schema: solidSchema,supportsEffects: true,});diff --git a/packages/core/src/index.ts b/packages/core/src/index.tsindex a027a2d88a..b2e8c339c1 100644--- a/packages/core/src/index.ts+++ b/packages/core/src/index.ts@@ -7,6 +7,7 @@ import type {AnyCompMetadata,AnyComposition,AudioOrVideoAsset,+ JsxComponentIdentity,LoopDisplay,SequenceControls,TRenderAsset,@@ -325,6 +326,7 @@ export type {ArrayFieldSchema,ArrayItemFieldSchema,DelayRenderScope,+ JsxComponentIdentity,LoopDisplay,SequenceControls,SequenceFieldSchema,diff --git a/packages/core/src/internals.ts b/packages/core/src/internals.tsindex d5138dd709..aae9d4d4f2 100644--- a/packages/core/src/internals.ts+++ b/packages/core/src/internals.ts@@ -27,6 +27,7 @@ import {import {CompositionRenderErrorContext} from './composition-render-error-context.js';import {type CompProps} from './Composition.js';import type {+ JsxComponentIdentity,TCompMetadata,TComposition,TRenderAsset,@@ -433,6 +434,7 @@ export type {GetEffectDragOverrides,GetEffectPropStatuses,GetPropStatuses,+ JsxComponentIdentity,LoggingContextValue,MediaVolumeContextValue,NonceHistory,diff --git a/packages/core/src/series/index.tsx b/packages/core/src/series/index.tsxindex 869b15ae37..43ccab98a6 100644--- a/packages/core/src/series/index.tsx+++ b/packages/core/src/series/index.tsx@@ -157,6 +157,7 @@ const Series: React.ComponentType<SeriesProps> & {} = Object.assign(wrapInSchema({Component: SeriesInner,+ componentIdentity: 'dev.remotion.remotion.Series',schema: sequenceSchemaDefaultLayoutNone,supportsEffects: false,}),diff --git a/packages/core/src/wrap-in-schema.ts b/packages/core/src/wrap-in-schema.tsindex c18dc68108..5253925a16 100644--- a/packages/core/src/wrap-in-schema.ts+++ b/packages/core/src/wrap-in-schema.ts@@ -1,5 +1,8 @@import React, {forwardRef, useContext, useMemo, useState} from 'react';-import type {SequenceControls} from './CompositionManager.js';+import type {+ JsxComponentIdentity,+ SequenceControls,+} from './CompositionManager.js';import {deleteNestedKey} from './delete-nested-key.js';import {getPropStatusesCtx} from './effects/use-memoized-effects.js';import {@@ -103,12 +106,14 @@ const stackToOverrideMap: Record<string, string> = {};export const wrapInSchema = <S extends SequenceSchema, Props extends object>({Component,+ componentIdentity,schema,supportsEffects,}: {Component: React.ComponentType<Props & {readonly _experimentalControls: SequenceControls | undefined}>;+ componentIdentity: JsxComponentIdentity | null;schema: S;supportsEffects: boolean;}): React.ComponentType<Props> => {@@ -191,6 +196,7 @@ export const wrapInSchema = <S extends SequenceSchema, Props extends object>({currentRuntimeValueDotNotation,overrideId,supportsEffects,+ componentIdentity,};}, [currentRuntimeValueDotNotation, overrideId]);diff --git a/packages/example/e2e/node-path-cache.test.mts b/packages/example/e2e/node-path-cache.test.mtsindex 7d815b1f9e..248057bfbe 100644--- a/packages/example/e2e/node-path-cache.test.mts+++ b/packages/example/e2e/node-path-cache.test.mts@@ -57,6 +57,8 @@ test.describe('node-path cache for stale source maps', () => {fileName: 'src/NewVideo.tsx',line: videoLine,column: 0,+ nodePath: null,+ componentIdentity: 'dev.remotion.media.Video',effects: [],keys: getAllSchemaKeys(NoReactInternals.sequenceSchema),clientId: 'e2e-cache-test-1',@@ -90,6 +92,8 @@ test.describe('node-path cache for stale source maps', () => {fileName: 'src/NewVideo.tsx',line: videoLine, // stale line numbercolumn: 0,+ nodePath: null,+ componentIdentity: 'dev.remotion.media.Video',keys: getAllSchemaKeys(NoReactInternals.sequenceSchema),effects: [],clientId: 'e2e-cache-test-2',@@ -105,4 +109,71 @@ test.describe('node-path cache for stale source maps', () => {result1.data.success && result1.data.nodePath,);});++ test('subscribe-to-sequence-props reconnects when a stale node path points to a different component', async () => {+ const content = fs.readFileSync(newVideoFile, 'utf-8');+ const lines = content.split('\n');+ const videoLineIndex = lines.findIndex((l) => l.includes('<Video'));+ expect(videoLineIndex).toBeGreaterThan(-1);+ const videoLine = videoLineIndex + 1;++ const result1 = await apiCall('/api/subscribe-to-sequence-props', {+ fileName: 'src/NewVideo.tsx',+ line: videoLine,+ column: 0,+ nodePath: null,+ componentIdentity: 'dev.remotion.media.Video',+ keys: ['debugOverlay'],+ effects: [],+ clientId: 'e2e-identity-mismatch-1',+ });+ expect(result1.success).toBe(true);+ assert(result1.success);+ expect(result1.data.success).toBe(true);+ assert(result1.data.success);+ expect(result1.data.status.canUpdate).toBe(true);+ assert(result1.data.status.canUpdate);+ expect(result1.data.status.props.debugOverlay).toEqual({+ status: 'static',+ codeValue: true,+ });++ const staleNodePath = result1.data.nodePath.nodePath;+ const editedContent = content.replace(+ 'return <Video src={src} debugOverlay />;',+ 'return (\n\t\t<Sequence>\n\t\t\t<Video src={src} debugOverlay />\n\t\t</Sequence>\n\t);',+ );+ expect(editedContent).not.toBe(content);+ fs.writeFileSync(newVideoFile, editedContent);++ const editedLines = editedContent.split('\n');+ const newVideoLineIndex = editedLines.findIndex((l) =>+ l.includes('<Video'),+ );+ expect(newVideoLineIndex).toBeGreaterThan(-1);+ const newVideoLine = newVideoLineIndex + 1;+ expect(newVideoLine).not.toBe(videoLine);++ const result2 = await apiCall('/api/subscribe-to-sequence-props', {+ fileName: 'src/NewVideo.tsx',+ line: newVideoLine,+ column: 0,+ nodePath: staleNodePath,+ componentIdentity: 'dev.remotion.media.Video',+ keys: ['debugOverlay'],+ effects: [],+ clientId: 'e2e-identity-mismatch-2',+ });+ expect(result2.success).toBe(true);+ assert(result2.success);+ expect(result2.data.success).toBe(true);+ assert(result2.data.success);+ expect(result2.data.status.canUpdate).toBe(true);+ assert(result2.data.status.canUpdate);+ expect(result2.data.status.props.debugOverlay).toEqual({+ status: 'static',+ codeValue: true,+ });+ expect(result2.data.nodePath.nodePath).not.toEqual(staleNodePath);+ });});diff --git a/packages/gif/src/Gif.tsx b/packages/gif/src/Gif.tsxindex 23c1c5cbd2..10dc85b108 100644--- a/packages/gif/src/Gif.tsx+++ b/packages/gif/src/Gif.tsx@@ -127,6 +127,7 @@ const GifInner = ({export const Gif = wrapInSchema({Component: GifInner,+ componentIdentity: 'dev.remotion.gif.Gif',schema: gifSchema,supportsEffects: true,});diff --git a/packages/light-leaks/src/LightLeak.tsx b/packages/light-leaks/src/LightLeak.tsxindex 50859db2e9..c191858d26 100644--- a/packages/light-leaks/src/LightLeak.tsx+++ b/packages/light-leaks/src/LightLeak.tsx@@ -302,6 +302,7 @@ const LightLeakInner: React.FC<export const LightLeak = Internals.wrapInSchema({Component: LightLeakInner,+ componentIdentity: 'dev.remotion.lightLeaks.LightLeak',schema: lightLeakSchema,supportsEffects: false,});diff --git a/packages/media/src/audio/audio.tsx b/packages/media/src/audio/audio.tsxindex b25eea186e..743edf08ff 100644--- a/packages/media/src/audio/audio.tsx+++ b/packages/media/src/audio/audio.tsx@@ -164,6 +164,7 @@ const AudioInner: React.FC<export const Audio = Internals.wrapInSchema({Component: AudioInner,+ componentIdentity: 'dev.remotion.media.Audio',schema: audioSchema,supportsEffects: false,});diff --git a/packages/media/src/video/video.tsx b/packages/media/src/video/video.tsxindex c509012d78..be1d750c8c 100644--- a/packages/media/src/video/video.tsx+++ b/packages/media/src/video/video.tsx@@ -360,6 +360,7 @@ const VideoInner: React.FC<export const Video = Internals.wrapInSchema({Component: VideoInner,+ componentIdentity: 'dev.remotion.media.Video',schema: videoSchema,supportsEffects: true,});diff --git a/packages/rive/src/RemotionRiveCanvas.tsx b/packages/rive/src/RemotionRiveCanvas.tsxindex 8b1e3a4004..566edd4688 100644--- a/packages/rive/src/RemotionRiveCanvas.tsx+++ b/packages/rive/src/RemotionRiveCanvas.tsx@@ -502,6 +502,7 @@ export const RemotionRiveCanvas = wrapInSchema({readonly _experimentalControls: SequenceControls | undefined;}>,+ componentIdentity: 'dev.remotion.rive.RemotionRiveCanvas',schema: riveCanvasSchema,supportsEffects: true,}) as React.ForwardRefExoticComponent<diff --git a/packages/shapes/src/components/arrow.tsx b/packages/shapes/src/components/arrow.tsxindex 3fdc38f583..8d0e6644d8 100644--- a/packages/shapes/src/components/arrow.tsx+++ b/packages/shapes/src/components/arrow.tsx@@ -79,6 +79,7 @@ const ArrowInner: React.FC<ArrowProps> = ({export const Arrow = Internals.wrapInSchema({Component: ArrowInner,+ componentIdentity: 'dev.remotion.shapes.Arrow',schema: arrowSchema,supportsEffects: true,}) as React.FC<ArrowProps>;diff --git a/packages/shapes/src/components/circle.tsx b/packages/shapes/src/components/circle.tsxindex 5a1e372d91..30829ee732 100644--- a/packages/shapes/src/components/circle.tsx+++ b/packages/shapes/src/components/circle.tsx@@ -34,6 +34,7 @@ const CircleInner: React.FC<CircleProps> = ({radius, ...props}) => {export const Circle = Internals.wrapInSchema({Component: CircleInner,+ componentIdentity: 'dev.remotion.shapes.Circle',schema: circleSchema,supportsEffects: true,}) as React.FC<CircleProps>;diff --git a/packages/shapes/src/components/ellipse.tsx b/packages/shapes/src/components/ellipse.tsxindex 5325a17870..21759573d6 100644--- a/packages/shapes/src/components/ellipse.tsx+++ b/packages/shapes/src/components/ellipse.tsx@@ -41,6 +41,7 @@ const EllipseInner: React.FC<EllipseProps> = ({rx, ry, ...props}) => {export const Ellipse = Internals.wrapInSchema({Component: EllipseInner,+ componentIdentity: 'dev.remotion.shapes.Ellipse',schema: ellipseSchema,supportsEffects: true,}) as React.FC<EllipseProps>;diff --git a/packages/shapes/src/components/heart.tsx b/packages/shapes/src/components/heart.tsxindex 380186901d..40c94801d3 100644--- a/packages/shapes/src/components/heart.tsx+++ b/packages/shapes/src/components/heart.tsx@@ -61,6 +61,7 @@ const HeartInner: React.FC<HeartProps> = ({export const Heart = Internals.wrapInSchema({Component: HeartInner,+ componentIdentity: 'dev.remotion.shapes.Heart',schema: heartSchema,supportsEffects: true,}) as React.FC<HeartProps>;diff --git a/packages/shapes/src/components/pie.tsx b/packages/shapes/src/components/pie.tsxindex 638f13c577..8b649c6fc2 100644--- a/packages/shapes/src/components/pie.tsx+++ b/packages/shapes/src/components/pie.tsx@@ -66,6 +66,7 @@ const PieInner: React.FC<PieProps> = ({export const Pie = Internals.wrapInSchema({Component: PieInner,+ componentIdentity: 'dev.remotion.shapes.Pie',schema: pieSchema,supportsEffects: true,}) as React.FC<PieProps>;diff --git a/packages/shapes/src/components/polygon.tsx b/packages/shapes/src/components/polygon.tsxindex 790c1789d4..3ae0f408db 100644--- a/packages/shapes/src/components/polygon.tsx+++ b/packages/shapes/src/components/polygon.tsx@@ -51,6 +51,7 @@ const PolygonInner: React.FC<PolygonProps> = ({export const Polygon = Internals.wrapInSchema({Component: PolygonInner,+ componentIdentity: 'dev.remotion.shapes.Polygon',schema: polygonSchema,supportsEffects: true,}) as React.FC<PolygonProps>;diff --git a/packages/shapes/src/components/rect.tsx b/packages/shapes/src/components/rect.tsxindex d804d43dd1..5a429dfc3e 100644--- a/packages/shapes/src/components/rect.tsx+++ b/packages/shapes/src/components/rect.tsx@@ -53,6 +53,7 @@ const RectInner: React.FC<RectProps> = ({export const Rect = Internals.wrapInSchema({Component: RectInner,+ componentIdentity: 'dev.remotion.shapes.Rect',schema: rectSchema,supportsEffects: true,}) as React.FC<RectProps>;diff --git a/packages/shapes/src/components/star.tsx b/packages/shapes/src/components/star.tsxindex be2b130669..4df99486c9 100644--- a/packages/shapes/src/components/star.tsx+++ b/packages/shapes/src/components/star.tsx@@ -68,6 +68,7 @@ const StarInner: React.FC<StarProps> = ({export const Star = Internals.wrapInSchema({Component: StarInner,+ componentIdentity: 'dev.remotion.shapes.Star',schema: starSchema,supportsEffects: true,}) as React.FC<StarProps>;diff --git a/packages/shapes/src/components/triangle.tsx b/packages/shapes/src/components/triangle.tsxindex f39e4aab5c..c48423f342 100644--- a/packages/shapes/src/components/triangle.tsx+++ b/packages/shapes/src/components/triangle.tsx@@ -53,6 +53,7 @@ const TriangleInner: React.FC<TriangleProps> = ({export const Triangle = Internals.wrapInSchema({Component: TriangleInner,+ componentIdentity: 'dev.remotion.shapes.Triangle',schema: triangleSchema,supportsEffects: true,}) as React.FC<TriangleProps>;diff --git a/packages/starburst/src/Starburst.tsx b/packages/starburst/src/Starburst.tsxindex f2c9e4511d..413f38d08d 100644--- a/packages/starburst/src/Starburst.tsx+++ b/packages/starburst/src/Starburst.tsx@@ -436,6 +436,7 @@ const StarburstInner: React.FC<export const Starburst = Internals.wrapInSchema({Component: StarburstInner,+ componentIdentity: 'dev.remotion.starburst.Starburst',schema: starburstSchema,supportsEffects: false,});diff --git a/packages/studio-server/src/preview-server/jsx-component-identity.ts b/packages/studio-server/src/preview-server/jsx-component-identity.tsnew file mode 100644index 0000000000..1cb2874693--- /dev/null+++ b/packages/studio-server/src/preview-server/jsx-component-identity.ts@@ -0,0 +1,189 @@+import type {+ File,+ JSXIdentifier,+ JSXMemberExpression,+ JSXOpeningElement,+} from '@babel/types';+import type {JsxComponentIdentity} from 'remotion';+import {getImportedName} from '../helpers/imports';++export class JsxElementIdentityMismatchError extends Error {+ constructor() {+ super('JSX element identity changed');+ }+}++const jsxMemberToString = (+ expr: JSXMemberExpression | JSXIdentifier,+): string => {+ if (expr.type === 'JSXIdentifier') {+ return expr.name;+ }++ return `${jsxMemberToString(expr.object)}.${expr.property.name}`;+};++const getJsxRootIdentifier = (+ expr: JSXMemberExpression | JSXIdentifier,+): JSXIdentifier => {+ if (expr.type === 'JSXIdentifier') {+ return expr;+ }++ return getJsxRootIdentifier(expr.object);+};++const getTagName = (node: JSXOpeningElement): string | null => {+ if (node.name.type === 'JSXIdentifier') {+ return node.name.name;+ }++ if (node.name.type === 'JSXMemberExpression') {+ return jsxMemberToString(node.name);+ }++ return null;+};++const getMemberPath = (tagName: string): string => {+ const dotIndex = tagName.indexOf('.');+ return dotIndex === -1 ? '' : tagName.slice(dotIndex + 1);+};++const getMemberPathAfterImportName = ({+ tagName,+ importName,+}: {+ tagName: string;+ importName: string;+}): string => {+ const parts = tagName.split('.');+ const importNameIndex = parts.indexOf(importName);+ if (importNameIndex === -1) {+ return getMemberPath(tagName);+ }++ return parts.slice(importNameIndex + 1).join('.');+};++const sourcePathToIdentityPrefix = (sourcePath: string): string | null => {+ if (sourcePath === 'remotion') {+ return 'dev.remotion.remotion';+ }++ if (sourcePath.startsWith('@remotion/')) {+ const packageName = sourcePath+ .slice('@remotion/'.length)+ .replace(/-([a-z])/g, (_, char: string) => char.toUpperCase());+ return `dev.remotion.${packageName}`;+ }++ return null;+};++const makeImportedIdentity = ({+ sourcePath,+ importName,+ memberPath,+}: {+ sourcePath: string;+ importName: string;+ memberPath: string;+}): JsxComponentIdentity | null => {+ const prefix = sourcePathToIdentityPrefix(sourcePath);+ if (prefix === null) {+ return null;+ }++ return [prefix, importName, memberPath].filter(Boolean).join('.');+};++export const getJsxComponentIdentity = ({+ ast,+ jsxElement,+}: {+ ast: File;+ jsxElement: JSXOpeningElement;+}): JsxComponentIdentity | null => {+ const tagName = getTagName(jsxElement);+ if (tagName === null) {+ return null;+ }++ const rootIdentifier =+ jsxElement.name.type === 'JSXIdentifier'+ ? jsxElement.name+ : jsxElement.name.type === 'JSXMemberExpression'+ ? getJsxRootIdentifier(jsxElement.name)+ : null;+ if (rootIdentifier === null) {+ return tagName;+ }++ for (const node of ast.program.body) {+ if (node.type !== 'ImportDeclaration') {+ continue;+ }++ const sourcePath = String(node.source.value);+ for (const specifier of node.specifiers) {+ if (+ specifier.type === 'ImportSpecifier' &&+ specifier.local?.name === rootIdentifier.name+ ) {+ const importName = getImportedName(specifier);+ return makeImportedIdentity({+ sourcePath,+ importName,+ memberPath: getMemberPath(tagName),+ });+ }++ if (+ specifier.type === 'ImportNamespaceSpecifier' &&+ specifier.local.name === rootIdentifier.name+ ) {+ const [importName, ...members] = getMemberPath(tagName).split('.');+ if (!importName) {+ return null;+ }++ return makeImportedIdentity({+ sourcePath,+ importName,+ memberPath: members.join('.'),+ });+ }++ if (+ specifier.type === 'ImportDefaultSpecifier' &&+ specifier.local.name === rootIdentifier.name+ ) {+ return makeImportedIdentity({+ sourcePath,+ importName: 'default',+ memberPath: getMemberPathAfterImportName({+ tagName,+ importName: rootIdentifier.name,+ }),+ });+ }+ }+ }++ return tagName;+};++export const jsxComponentIdentitiesMatch = ({+ expected,+ actual,+}: {+ expected: JsxComponentIdentity | null;+ actual: JsxComponentIdentity | null;+}): boolean => {+ if (expected === null) {+ return true;+ }++ return expected === actual;+};diff --git a/packages/studio-server/src/preview-server/routes/add-sequence-keyframe.ts b/packages/studio-server/src/preview-server/routes/add-sequence-keyframe.tsindex 07636a2f5c..1d973a5e1c 100644--- a/packages/studio-server/src/preview-server/routes/add-sequence-keyframe.ts+++ b/packages/studio-server/src/preview-server/routes/add-sequence-keyframe.ts@@ -107,6 +107,7 @@ export const addSequenceKeyframeHandler: ApiHandler<fileContents: output,keys: getAllSchemaKeys(schema),nodePath: updatedNodePath,+ componentIdentity: null,effects: [],});const updatedSubscriptionKey = {...nodePath, nodePath: updatedNodePath};diff --git a/packages/studio-server/src/preview-server/routes/can-update-sequence-props.ts b/packages/studio-server/src/preview-server/routes/can-update-sequence-props.tsindex e699fa17d1..ea3df94de0 100644--- a/packages/studio-server/src/preview-server/routes/can-update-sequence-props.ts+++ b/packages/studio-server/src/preview-server/routes/can-update-sequence-props.ts@@ -19,6 +19,7 @@ import type {CanUpdateSequencePropsResponseTrue,CanUpdateSequencePropStatus,ExtrapolateType,+ JsxComponentIdentity,LogLevel,SequenceNodePath,} from 'remotion';@@ -27,6 +28,11 @@ import {parseAst} from '../../codemods/parse-ast';import {getAstNodePath} from '../../helpers/get-ast-node-path';import {toImportAgnosticNodePath} from '../../helpers/import-agnostic-node-path';import {resolveFileInsideProject} from '../../helpers/resolve-file-inside-project';+import {+ getJsxComponentIdentity,+ JsxElementIdentityMismatchError,+ jsxComponentIdentitiesMatch,+} from '../jsx-component-identity';import {JsxElementNotFoundAtLocationError} from '../jsx-element-not-found-at-location-error';import {computeEffectPropStatus} from './can-update-effect-props';@@ -881,11 +887,13 @@ const computeSequenceOnlyPropsRecord = ({export const computeSequencePropsStatusFromContent = ({fileContents,nodePath,+ componentIdentity,keys,effects,}: {fileContents: string;nodePath: SequenceNodePath;+ componentIdentity: JsxComponentIdentity | null;keys: string[];effects: string[][];}): CanUpdateSequencePropsResponseTrue => {@@ -897,6 +905,15 @@ export const computeSequencePropsStatusFromContent = ({throw new JsxElementNotFoundAtLocationError();}+ if (+ !jsxComponentIdentitiesMatch({+ expected: componentIdentity,+ actual: getJsxComponentIdentity({ast, jsxElement}),+ })+ ) {+ throw new JsxElementIdentityMismatchError();+ }+const filteredProps = computeSequenceOnlyPropsRecord({jsxElement, ast, keys});const effectsStatuses = computeEffectsForJsx({ast, jsxElement, effects});@@ -910,12 +927,14 @@ export const computeSequencePropsStatusFromContent = ({export const computeSequencePropsStatus = ({fileName,nodePath,+ componentIdentity,keys,effects,remotionRoot,}: {fileName: string;nodePath: SequenceNodePath;+ componentIdentity: JsxComponentIdentity | null;keys: string[];effects: string[][];remotionRoot: string;@@ -930,6 +949,7 @@ export const computeSequencePropsStatus = ({return computeSequencePropsStatusFromContent({fileContents,nodePath,+ componentIdentity,keys,effects,});@@ -938,6 +958,7 @@ export const computeSequencePropsStatus = ({export const computeSequencePropsStatusFromFilenameByLine = ({fileName,line,+ componentIdentity,keys,effects,remotionRoot,@@ -945,6 +966,7 @@ export const computeSequencePropsStatusFromFilenameByLine = ({}: {fileName: string;line: number;+ componentIdentity: JsxComponentIdentity | null;keys: string[];effects: string[][];remotionRoot: string;@@ -975,6 +997,7 @@ export const computeSequencePropsStatusFromFilenameByLine = ({status: computeSequencePropsStatus({fileName,nodePath: resolvedNodePath,+ componentIdentity,keys,effects,remotionRoot,diff --git a/packages/studio-server/src/preview-server/routes/delete-keyframes.ts b/packages/studio-server/src/preview-server/routes/delete-keyframes.tsindex cf4765c5a1..a6a053660c 100644--- a/packages/studio-server/src/preview-server/routes/delete-keyframes.ts+++ b/packages/studio-server/src/preview-server/routes/delete-keyframes.ts@@ -332,6 +332,7 @@ export const deleteKeyframes = async ({fileContents: output,keys: getAllSchemaKeys(keyframe.schema),nodePath: keyframe.nodePath.nodePath,+ componentIdentity: null,effects: [],});diff --git a/packages/studio-server/src/preview-server/routes/save-sequence-props.ts b/packages/studio-server/src/preview-server/routes/save-sequence-props.tsindex 88f4c65c89..5a5d24fa9f 100644--- a/packages/studio-server/src/preview-server/routes/save-sequence-props.ts+++ b/packages/studio-server/src/preview-server/routes/save-sequence-props.ts@@ -223,6 +223,7 @@ export const saveSequencePropsHandler: ApiHandler<fileContents: output,keys: getAllSchemaKeys(edit.schema),nodePath: edit.nodePath.nodePath,+ componentIdentity: null,effects: [],});diff --git a/packages/studio-server/src/preview-server/routes/subscribe-to-sequence-props.ts b/packages/studio-server/src/preview-server/routes/subscribe-to-sequence-props.tsindex 5176af739d..0558f9da5f 100644--- a/packages/studio-server/src/preview-server/routes/subscribe-to-sequence-props.ts+++ b/packages/studio-server/src/preview-server/routes/subscribe-to-sequence-props.ts@@ -9,7 +9,16 @@ export const subscribeToSequenceProps: ApiHandler<SubscribeToSequencePropsRequest,SubscribeToSequencePropsResponse> = ({- input: {fileName, line, column, nodePath, keys, effects, clientId},+ input: {+ fileName,+ line,+ column,+ nodePath,+ componentIdentity,+ keys,+ effects,+ clientId,+ },remotionRoot,logLevel,}) => {@@ -18,6 +27,7 @@ export const subscribeToSequenceProps: ApiHandler<line,column,nodePath,+ componentIdentity,keys,effects,remotionRoot,diff --git a/packages/studio-server/src/preview-server/routes/update-sequence-keyframe-settings.ts b/packages/studio-server/src/preview-server/routes/update-sequence-keyframe-settings.tsindex 64574a841d..b519a28f3a 100644--- a/packages/studio-server/src/preview-server/routes/update-sequence-keyframe-settings.ts+++ b/packages/studio-server/src/preview-server/routes/update-sequence-keyframe-settings.ts@@ -109,6 +109,7 @@ export const updateSequenceKeyframeSettingsHandler: ApiHandler<fileContents: output,keys: getAllSchemaKeys(schema),nodePath: updatedNodePath,+ componentIdentity: null,effects: [],});const updatedSubscriptionKey = {...nodePath, nodePath: updatedNodePath};diff --git a/packages/studio-server/src/preview-server/sequence-props-watchers.ts b/packages/studio-server/src/preview-server/sequence-props-watchers.tsindex 3f38712224..23a0cd5ebc 100644--- a/packages/studio-server/src/preview-server/sequence-props-watchers.ts+++ b/packages/studio-server/src/preview-server/sequence-props-watchers.ts@@ -5,8 +5,9 @@ import {stringifySequenceSubscriptionKey,type SubscribeToSequencePropsResponse,} from '@remotion/studio-shared';-import type {SequenceNodePath} from 'remotion';+import type {JsxComponentIdentity, SequenceNodePath} from 'remotion';import {installFileWatcher} from '../file-watcher';+import {JsxElementIdentityMismatchError} from './jsx-component-identity';import {JsxElementNotFoundAtLocationError} from './jsx-element-not-found-at-location-error';import {waitForLiveEventsListener} from './live-events';import {getCachedNodePath, setCachedNodePath} from './node-path-cache';@@ -28,6 +29,7 @@ const getSequencePropsStatus = ({line,column,preferredNodePath,+ componentIdentity,keys,effects,remotionRoot,@@ -37,44 +39,71 @@ const getSequencePropsStatus = ({line: number;column: number;preferredNodePath: SequenceNodePath | null;+ componentIdentity: JsxComponentIdentity | null;keys: string[];effects: string[][];remotionRoot: string;logLevel: LogLevel;}): SubscribeToSequencePropsResponse => {if (preferredNodePath) {- const fromNodePath = computeSequencePropsStatus({- fileName,- nodePath: preferredNodePath,- keys,- effects,- remotionRoot,- });- return {- status: fromNodePath,- nodePath: {- absolutePath: path.resolve(remotionRoot, fileName),+ try {+ const fromNodePath = computeSequencePropsStatus({+ fileName,nodePath: preferredNodePath,- sequenceKeys: keys,- effectKeys: effects,- },- success: true,- };+ componentIdentity,+ keys,+ effects,+ remotionRoot,+ });+ return {+ status: fromNodePath,+ nodePath: {+ absolutePath: path.resolve(remotionRoot, fileName),+ nodePath: preferredNodePath,+ sequenceKeys: keys,+ effectKeys: effects,+ },+ success: true,+ };+ } catch (error) {+ if (+ !(+ error instanceof JsxElementIdentityMismatchError ||+ error instanceof JsxElementNotFoundAtLocationError+ )+ ) {+ throw error;+ }+ }}// Try cached nodePath first (handles stale source maps after suppressed rebuilds)const cachedNodePath = getCachedNodePath(fileName, line, column);if (cachedNodePath) {- const cachedResult = computeSequencePropsStatus({- fileName,- nodePath: cachedNodePath,- keys,- effects,- remotionRoot,- });+ const cachedResult = (() => {+ try {+ return computeSequencePropsStatus({+ fileName,+ nodePath: cachedNodePath,+ componentIdentity,+ keys,+ effects,+ remotionRoot,+ });+ } catch (error) {+ if (+ error instanceof JsxElementIdentityMismatchError ||+ error instanceof JsxElementNotFoundAtLocationError+ ) {+ return null;+ }++ throw error;+ }+ })();- if (cachedResult.canUpdate) {+ if (cachedResult?.canUpdate) {return {status: cachedResult,nodePath: {@@ -91,6 +120,7 @@ const getSequencePropsStatus = ({const status = computeSequencePropsStatusFromFilenameByLine({fileName,line,+ componentIdentity,keys,effects,remotionRoot,@@ -105,6 +135,7 @@ export const subscribeToSequencePropsWatchers = ({line,column,nodePath: preferredNodePath,+ componentIdentity,keys,effects,remotionRoot,@@ -115,6 +146,7 @@ export const subscribeToSequencePropsWatchers = ({line: number;column: number;nodePath: SequenceNodePath | null;+ componentIdentity: JsxComponentIdentity | null;keys: string[];effects: string[][];remotionRoot: string;@@ -126,6 +158,7 @@ export const subscribeToSequencePropsWatchers = ({line,column,preferredNodePath,+ componentIdentity,keys,effects,remotionRoot,@@ -166,6 +199,7 @@ export const subscribeToSequencePropsWatchers = ({const result = computeSequencePropsStatusFromContent({fileContents: event.content,nodePath: nodePath.nodePath,+ componentIdentity,keys,effects,});@@ -194,7 +228,10 @@ export const subscribeToSequencePropsWatchers = ({});});} catch (error) {- if (error instanceof JsxElementNotFoundAtLocationError) {+ if (+ error instanceof JsxElementNotFoundAtLocationError ||+ error instanceof JsxElementIdentityMismatchError+ ) {waitForLiveEventsListener().then((listener) => {listener.sendEventToClientId(clientId, {type: 'lost-node-path',diff --git a/packages/studio-server/src/test/compute-sequence-props-status.test.ts b/packages/studio-server/src/test/compute-sequence-props-status.test.tsindex f4ee0f158f..1ee313a28e 100644--- a/packages/studio-server/src/test/compute-sequence-props-status.test.ts+++ b/packages/studio-server/src/test/compute-sequence-props-status.test.ts@@ -2,6 +2,7 @@ import {expect, test} from 'bun:test';import {readFileSync} from 'node:fs';import path from 'node:path';import {parseAst} from '../codemods/parse-ast';+import {JsxElementIdentityMismatchError} from '../preview-server/jsx-component-identity';import {computeSequencePropsStatus,computeSequencePropsStatusFromContent,@@ -34,6 +35,7 @@ test('canUpdateSequenceProps should flag computed props', () => {const result = computeSequencePropsStatus({fileName: filePath,nodePath: getNodePath(filePath, 8),+ componentIdentity: null,keys: ['durationInFrames', 'seed', 'hueShift', 'nonExistentProp'],effects: [],remotionRoot: '/',@@ -73,6 +75,7 @@ export const Example: React.FC = () => {const result = computeSequencePropsStatusFromContent({fileContents: input,nodePath: getNodePathFromContent(input, 7),+ componentIdentity: null,keys: ['color'],effects: [],});@@ -93,6 +96,58 @@ export const Example: React.FC = () => {});});+test('computeSequencePropsStatus should reject a node path with the wrong component identity', () => {+ const input = `import React from 'react';+import {Interactive} from 'remotion';+import {Star} from '@remotion/shapes';++export const Example: React.FC = () => {+\treturn (+\t\t<Interactive.Div>+\t\t\t<Star points={20} innerRadius={174} outerRadius={207} />+\t\t</Interactive.Div>+\t);+};+`;++ expect(() =>+ computeSequencePropsStatusFromContent({+ fileContents: input,+ nodePath: getNodePathFromContent(input, 7),+ componentIdentity: 'dev.remotion.shapes.Star',+ keys: ['points'],+ effects: [],+ }),+ ).toThrow(JsxElementIdentityMismatchError);+});++test('computeSequencePropsStatus should match namespace imports by component identity', () => {+ const input = `import React from 'react';+import * as Remotion from 'remotion';++export const Example: React.FC = () => {+\treturn (+\t\t<Remotion.Sequence from={10} durationInFrames={20} />+\t);+};+`;+ const result = computeSequencePropsStatusFromContent({+ fileContents: input,+ nodePath: getNodePathFromContent(input, 6),+ componentIdentity: 'dev.remotion.remotion.Sequence',+ keys: ['from'],+ effects: [],+ });++ expect(result.canUpdate).toBe(true);+ if (!result.canUpdate) throw new Error('Expected canUpdate to be true');++ expect(result.props.from).toEqual({+ status: 'static',+ codeValue: 10,+ });+});+test('computeSequencePropsStatus should return easing for interpolated color props', () => {const input = `import React from 'react';import {Easing, Solid, interpolateColors, useCurrentFrame} from 'remotion';@@ -107,6 +162,7 @@ export const Example: React.FC = () => {const result = computeSequencePropsStatusFromContent({fileContents: input,nodePath: getNodePathFromContent(input, 7),+ componentIdentity: null,keys: ['color'],effects: [],});@@ -142,6 +198,7 @@ export const Example: React.FC = () => {const result = computeSequencePropsStatusFromContent({fileContents: input,nodePath: getNodePathFromContent(input, 7),+ componentIdentity: null,keys: ['style.translate'],effects: [],});@@ -177,6 +234,7 @@ export const Example: React.FC = () => {const result = computeSequencePropsStatusFromContent({fileContents: input,nodePath: getNodePathFromContent(input, 8),+ componentIdentity: null,keys: ['style.translate'],effects: [],});@@ -203,6 +261,7 @@ export const Example: React.FC = () => {const result = computeSequencePropsStatusFromContent({fileContents: input,nodePath: getNodePathFromContent(input, 7),+ componentIdentity: null,keys: ['style.rotate'],effects: [],});@@ -232,6 +291,7 @@ test('computeSequencePropsStatus should explain why outside-project file reads wcomputeSequencePropsStatus({fileName,nodePath: [],+ componentIdentity: null,keys: [],effects: [],remotionRoot,@@ -246,6 +306,7 @@ test('computeSequencePropsStatus should detect static nested props', () => {const result = computeSequencePropsStatus({fileName: filePath,nodePath: getNodePath(filePath, 7),+ componentIdentity: null,keys: ['style.opacity', 'style.scale'],effects: [],remotionRoot: '/',@@ -269,6 +330,7 @@ test('computeSequencePropsStatus should flag computed nested props', () => {const result = computeSequencePropsStatus({fileName: filePath,nodePath: getNodePath(filePath, 8),+ componentIdentity: null,keys: ['style.opacity', 'style.scale'],effects: [],remotionRoot: '/',@@ -293,6 +355,7 @@ test('computeSequencePropsStatus should flag computed when parent is not an objeconst result = computeSequencePropsStatus({fileName: filePath,nodePath: getNodePath(filePath, 9),+ componentIdentity: null,keys: ['style.opacity'],effects: [],remotionRoot: '/',@@ -312,6 +375,7 @@ test('computeSequencePropsStatus should report unset nested props as undefined',const result = computeSequencePropsStatus({fileName: filePath,nodePath: getNodePath(filePath, 7),+ componentIdentity: null,keys: ['style.rotate'],effects: [],remotionRoot: '/',@@ -331,6 +395,7 @@ test('computeSequencePropsStatus should report unset when parent attribute missiconst result = computeSequencePropsStatus({fileName: filePath,nodePath: getNodePath(filePath, 10),+ componentIdentity: null,keys: ['style.opacity'],effects: [],remotionRoot: '/',@@ -350,6 +415,7 @@ test('computeSequencePropsStatus should return keyframes for interpolated styleconst result = computeSequencePropsStatus({fileName: filePath,nodePath: getNodePath(filePath, 8),+ componentIdentity: null,keys: ['style.scale'],effects: [],remotionRoot: '/',@@ -390,6 +456,7 @@ export const Example: React.FC = () => {const result = computeSequencePropsStatusFromContent({fileContents: input,nodePath: getNodePathFromContent(input, 7),+ componentIdentity: null,keys: ['style.scale'],effects: [],});@@ -429,6 +496,7 @@ export const Example: React.FC = () => {const result = computeSequencePropsStatusFromContent({fileContents: input,nodePath: getNodePathFromContent(input, 7),+ componentIdentity: null,keys: ['style.scale'],effects: [],});@@ -464,6 +532,7 @@ export const Example: React.FC = () => {const result = computeSequencePropsStatusFromContent({fileContents: input,nodePath: getNodePathFromContent(input, 7),+ componentIdentity: null,keys: ['color'],effects: [],});@@ -500,6 +569,7 @@ export const Example: React.FC = () => {const result = computeSequencePropsStatusFromContent({fileContents: input,nodePath: getNodePathFromContent(input, 8),+ componentIdentity: null,keys: ['style.scale'],effects: [],});@@ -529,6 +599,7 @@ export const Example: React.FC = () => {const result = computeSequencePropsStatusFromContent({fileContents: input,nodePath: getNodePathFromContent(input, 7),+ componentIdentity: null,keys: ['style.scale'],effects: [],});diff --git a/packages/studio-server/src/test/unsupported-translate.test.ts b/packages/studio-server/src/test/unsupported-translate.test.tsindex d21b1ded83..dddb2e34e9 100644--- a/packages/studio-server/src/test/unsupported-translate.test.ts+++ b/packages/studio-server/src/test/unsupported-translate.test.ts@@ -29,6 +29,7 @@ const getTranslateStatus = (translateValue: string) => {const result = computeSequencePropsStatusFromContent({fileContents: input,nodePath: lineColumnToNodePath(input, 7),+ componentIdentity: null,keys: ['style.translate'],effects: [],});diff --git a/packages/studio-server/src/test/update-keyframes.test.ts b/packages/studio-server/src/test/update-keyframes.test.tsindex cf6077c536..24015f47fa 100644--- a/packages/studio-server/src/test/update-keyframes.test.ts+++ b/packages/studio-server/src/test/update-keyframes.test.ts@@ -665,6 +665,7 @@ export const Example: React.FC = () => {const status = computeSequencePropsStatusFromContent({fileContents: output,nodePath: updatedNodePath,+ componentIdentity: null,keys: ['style.translate'],effects: [],});@@ -808,6 +809,7 @@ export default CenteredSolid;const status = computeSequencePropsStatusFromContent({fileContents: output,nodePath: updatedNodePath,+ componentIdentity: null,keys: ['width'],effects: [],});@@ -986,6 +988,7 @@ test('updateSequenceKeyframes converts the last keyframe to a static value', asyconst status = computeSequencePropsStatusFromContent({fileContents: output,nodePath: updatedNodePath,+ componentIdentity: null,keys: ['style.scale'],effects: [],});@@ -1088,6 +1091,7 @@ test('updateSequenceKeyframes converts the last color keyframe to a static valueconst status = computeSequencePropsStatusFromContent({fileContents: output,nodePath: updatedNodePath,+ componentIdentity: null,keys: ['color'],effects: [],});diff --git a/packages/studio-shared/src/api-requests.ts b/packages/studio-shared/src/api-requests.tsindex d8bb0514ce..68a70d671e 100644--- a/packages/studio-shared/src/api-requests.ts+++ b/packages/studio-shared/src/api-requests.ts@@ -18,6 +18,7 @@ import type {CanUpdateSequencePropsResponseTrue,CanUpdateSequencePropStatus,ExtrapolateType,+ JsxComponentIdentity,SequenceNodePath,SequencePropsSubscriptionKey,SequenceSchema,@@ -271,6 +272,7 @@ export type SubscribeToSequencePropsRequest = {line: number;column: number;nodePath: SequenceNodePath | null;+ componentIdentity: JsxComponentIdentity | null;keys: string[];effects: string[][];clientId: string;diff --git a/packages/studio/src/components/Timeline/SubscribeToNodePaths.tsx b/packages/studio/src/components/Timeline/SubscribeToNodePaths.tsxindex df03e267fa..29b62cbd5f 100644--- a/packages/studio/src/components/Timeline/SubscribeToNodePaths.tsx+++ b/packages/studio/src/components/Timeline/SubscribeToNodePaths.tsx@@ -1,15 +1,20 @@import {useMemo, type FC} from 'react';-import type {EffectDefinition, SequenceSchema} from 'remotion';+import type {+ EffectDefinition,+ JsxComponentIdentity,+ SequenceSchema,+} from 'remotion';import {NoReactInternals} from 'remotion/no-react';import {useResolveStackAndReactToChange} from './use-resolved-stack-react-to-change';import {useSequencePropsSubscription} from './use-sequence-props-subscription';export const SubscribeToNodePaths: FC<{readonly overrideId: string;+ readonly componentIdentity: JsxComponentIdentity | null;readonly schema: SequenceSchema;readonly getStack: () => string | null;readonly effects: readonly EffectDefinition<unknown>[];-}> = ({overrideId, schema, getStack, effects}) => {+}> = ({overrideId, componentIdentity, schema, getStack, effects}) => {const originalLocation = useResolveStackAndReactToChange(getStack);const effectSubscriptions = useMemo<SequenceSchema[]>(() => {@@ -22,6 +27,7 @@ export const SubscribeToNodePaths: FC<{useSequencePropsSubscription({overrideId,+ componentIdentity,schema,effects: effectSubscriptions,originalLocation,diff --git a/packages/studio/src/components/Timeline/Timeline.tsx b/packages/studio/src/components/Timeline/Timeline.tsxindex b370ece5e0..73f53d2137 100644--- a/packages/studio/src/components/Timeline/Timeline.tsx+++ b/packages/studio/src/components/Timeline/Timeline.tsx@@ -255,6 +255,7 @@ const TimelineInner: React.FC = () => {<SubscribeToNodePathskey={sequence.id}overrideId={sequence.controls.overrideId}+ componentIdentity={sequence.controls.componentIdentity}schema={sequence.controls.schema}getStack={sequence.getStack}effects={sequence.effects}diff --git a/packages/studio/src/components/Timeline/sequence-props-subscription-store.ts b/packages/studio/src/components/Timeline/sequence-props-subscription-store.tsindex 21f2d83c8d..18d15d2bae 100644--- a/packages/studio/src/components/Timeline/sequence-props-subscription-store.ts+++ b/packages/studio/src/components/Timeline/sequence-props-subscription-store.ts@@ -1,18 +1,30 @@import {getAllSchemaKeys} from '@remotion/studio-shared';-import type {SequenceNodePath, SequenceSchema} from 'remotion';+import type {+ JsxComponentIdentity,+ SequenceNodePath,+ SequenceSchema,+} from 'remotion';import {Internals} from 'remotion';import {callApi} from '../call-api';type Key = string;-const makeKey = (- fileName: string,- line: number,- column: number,- sequenceKeys: string[],- effectKeys: string[][],-): Key =>- `${fileName}\0${line}\0${column}\0${sequenceKeys.join('\0')}\0${effectKeys.map((keys) => keys.join('\0')).join('\0\0')}`;+const makeKey = ({+ fileName,+ line,+ column,+ componentIdentity,+ sequenceKeys,+ effectKeys,+}: {+ fileName: string;+ line: number;+ column: number;+ componentIdentity: JsxComponentIdentity | null;+ sequenceKeys: string[];+ effectKeys: string[][];+}): Key =>+ `${fileName}\0${line}\0${column}\0${componentIdentity ?? ''}\0${sequenceKeys.join('\0')}\0${effectKeys.map((keys) => keys.join('\0')).join('\0\0')}`;type SubscribeResult = Awaited<ReturnType<typeof callApi<'/api/subscribe-to-sequence-props'>>@@ -35,6 +47,7 @@ export const acquireSequencePropsSubscription = ({line,column,schema,+ componentIdentity,effects,nodePath,clientId,@@ -45,6 +58,7 @@ export const acquireSequencePropsSubscription = ({line: number;column: number;schema: SequenceSchema;+ componentIdentity: JsxComponentIdentity | null;effects: SequenceSchema[];nodePath: SequenceNodePath | null;clientId: string;@@ -53,7 +67,14 @@ export const acquireSequencePropsSubscription = ({}): {release: () => void} => {const sequenceKeys = getAllSchemaKeys(schema);const effectKeys = effects.map((effect) => getAllSchemaKeys(effect));- const key = makeKey(fileName, line, column, sequenceKeys, effectKeys);+ const key = makeKey({+ fileName,+ line,+ column,+ componentIdentity,+ sequenceKeys,+ effectKeys,+ });let entry = entries.get(key);if (!entry) {@@ -62,6 +83,7 @@ export const acquireSequencePropsSubscription = ({line,column,nodePath,+ componentIdentity,keys: getAllSchemaKeys(schema),effects: effectKeys,clientId,diff --git a/packages/studio/src/components/Timeline/use-sequence-props-subscription.ts b/packages/studio/src/components/Timeline/use-sequence-props-subscription.tsindex e5b685aa00..c72d8754d5 100644--- a/packages/studio/src/components/Timeline/use-sequence-props-subscription.ts+++ b/packages/studio/src/components/Timeline/use-sequence-props-subscription.ts@@ -3,7 +3,11 @@ import {stringifySequenceSubscriptionKey,} from '@remotion/studio-shared';import {useContext, useEffect, useMemo, useRef} from 'react';-import type {SequencePropsSubscriptionKey, SequenceSchema} from 'remotion';+import type {+ JsxComponentIdentity,+ SequencePropsSubscriptionKey,+ SequenceSchema,+} from 'remotion';import {Internals} from 'remotion';import type {OriginalPosition} from '../../error-overlay/react-overlay/utils/get-source-map';import {StudioServerConnectionCtx} from '../../helpers/client-id';@@ -13,10 +17,12 @@ import {acquireSequencePropsSubscription} from './sequence-props-subscription-stexport const useSequencePropsSubscription = ({originalLocation,overrideId,+ componentIdentity,schema,effects,}: {overrideId: string;+ componentIdentity: JsxComponentIdentity | null;schema: SequenceSchema;effects: SequenceSchema[];originalLocation: OriginalPosition | null;@@ -83,6 +89,7 @@ export const useSequencePropsSubscription = ({line: locationLine,column: locationColumn,schema,+ componentIdentity,effects,nodePath: nodePathAtResubscribe?.nodePath ?? null,clientId,@@ -127,6 +134,7 @@ export const useSequencePropsSubscription = ({};}, [clientId,+ componentIdentity,effects,effectsSignature,locationColumn,diff --git a/packages/studio/src/test/timeline-keyframes.test.ts b/packages/studio/src/test/timeline-keyframes.test.tsindex dbd37f71f2..2f4d06685f 100644--- a/packages/studio/src/test/timeline-keyframes.test.ts+++ b/packages/studio/src/test/timeline-keyframes.test.ts@@ -29,6 +29,7 @@ const makeControls = (currentRuntimeValueDotNotation: {},overrideId,supportsEffects: false,+ componentIdentity: null,});const makeSequence = ({diff --git a/packages/studio/src/test/timeline-selection.test.ts b/packages/studio/src/test/timeline-selection.test.tsindex 814581994d..4f747d5359 100644--- a/packages/studio/src/test/timeline-selection.test.ts+++ b/packages/studio/src/test/timeline-selection.test.ts@@ -181,6 +181,7 @@ const makeTimelineSequence = ({currentRuntimeValueDotNotation: {},overrideId,supportsEffects: true,+ componentIdentity: null,},refForOutline,isInsideSeries: false,