🎥 Make videos programmatically with React
remotion: Connect registered interactive components in Studio
Jonny Burger282060bb5f2a
diff --git a/packages/core/src/Interactive.tsx b/packages/core/src/Interactive.tsxindex ddab326827..3ab91bbae8 100644--- a/packages/core/src/Interactive.tsx+++ b/packages/core/src/Interactive.tsx@@ -1,9 +1,13 @@-import React, {forwardRef, useCallback} from 'react';+import React, {forwardRef, useCallback, useContext} from 'react';import type {JsxComponentIdentity,SequenceControls,} from './CompositionManager.js';-import {addSequenceStackTraces} from './enable-sequence-stack-traces.js';+import {CompositionManager} from './CompositionManagerContext.js';+import {+ addSequenceStackTraces,+ resolveComponentIdentity,+} from './enable-sequence-stack-traces.js';import {Freeze} from './freeze.js';import {backgroundSchema,@@ -349,6 +353,16 @@ const withSchema: WithSchema = (untypedOptions: unknown) => {unknown,ComponentWrappedInSequenceProps>((props, ref) => {+ const {canvasContent, compositions} = useContext(CompositionManager);+ // The render callback runs after the exported wrapper has been initialized.+ // eslint-disable-next-line @typescript-eslint/no-use-before-define+ const componentIdentity = resolveComponentIdentity(Wrapped);+ const isCurrentComposition = compositions.some(+ (composition) =>+ canvasContent?.type === 'composition' &&+ composition.id === canvasContent.compositionId &&+ composition.componentFromProps === componentIdentity,+ );const {durationInFrames,from,@@ -411,6 +425,9 @@ const withSchema: WithSchema = (untypedOptions: unknown) => {return (<Freeze frame={freezeFrame} active={isPremountingOrPostmounting}><SequenceWithoutSchema+ _remotionInternalSingleChildComponent={+ isCurrentComposition ? null : componentIdentity+ }layout="none"durationInFrames={durationInFrames}from={from}