Skip to content

🎥 Make videos programmatically with React

`@remotion/studio`: Read node path mappings from a ref in subscription effect

Jonny Burger35c9082497a7
diff --git a/packages/studio/src/components/Timeline/use-sequence-props-subscription.ts b/packages/studio/src/components/Timeline/use-sequence-props-subscription.ts
index 832a9ff517..d0764634ef 100644
--- a/packages/studio/src/components/Timeline/use-sequence-props-subscription.ts
+++ b/packages/studio/src/components/Timeline/use-sequence-props-subscription.ts
@@ -34,6 +34,8 @@ export const useSequencePropsSubscription = ({
const {previewServerState: state} = useContext(StudioServerConnectionCtx);
const previousNodePathRef = useRef<SequencePropsSubscriptionKey | null>(null);
+ const overrideIdToNodePathMappingsRef = useRef(overrideIdToNodePathMappings);
+ overrideIdToNodePathMappingsRef.current = overrideIdToNodePathMappings;
const clientId = state.type === 'connected' ? state.clientId : undefined;
const effectsSignature = useMemo(
@@ -74,7 +76,7 @@ export const useSequencePropsSubscription = ({
}
const nodePathAtResubscribe =
- overrideIdToNodePathMappings[overrideId] ?? null;
+ overrideIdToNodePathMappingsRef.current[overrideId] ?? null;
const {release} = acquireSequencePropsSubscription({
fileName: locationSource,