Skip to content

🎥 Make videos programmatically with React

fix premounting being cascading

Jonny Burger7644abe5d206
diff --git a/packages/core/src/Sequence.tsx b/packages/core/src/Sequence.tsx
index 065b5d9764..4f7000e9c9 100644
--- a/packages/core/src/Sequence.tsx
+++ b/packages/core/src/Sequence.tsx
@@ -311,7 +311,9 @@ const PremountedPostmountedSequenceRefForwardingFunction: React.ForwardRefRender
HTMLDivElement,
SequenceProps
> = (props, ref) => {
- const frame = useCurrentFrame();
+ const parentPremountContext = useContext(PremountContext);
+ const frame =
+ useCurrentFrame() - parentPremountContext.premountFramesRemaining;
if (props.layout === 'none') {
throw new Error(
@@ -362,7 +364,6 @@ const PremountedPostmountedSequenceRefForwardingFunction: React.ForwardRefRender
styleWhilePostmounted,
]);
- const parentPremountContext = useContext(PremountContext);
const {playing} = useContext(TimelineContext);
const premountFramesRemaining =
parentPremountContext.premountFramesRemaining +