Skip to content

Commit 4a3d993

Browse files
authored
Add the suffix to cancelled view transition names (facebook#35485)
When a View Transition might not need to update we add it to a queue. If the parent are able to be reverted, we then cancel the already started view transitions. We do this by adding an animation that hides the "old" state and remove the view transition name from the old state. There was a bug where if you have more than one child in a `<ViewTransition>` we didn't add the right suffix to the name we added in the queue so it wasn't adding an animation that hides the old state. The effect was that it playing an exit animation instead of being cancelled.
1 parent 3e1abcc commit 4a3d993

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/react-reconciler/src/ReactFiberCommitViewTransitions.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,11 @@ function measureViewTransitionHostInstancesRecursive(
711711
}
712712
viewTransitionCancelableChildren.push(
713713
instance,
714-
oldName,
714+
viewTransitionHostInstanceIdx === 0
715+
? oldName
716+
: // If we have multiple Host Instances below, we add a suffix to the name to give
717+
// each one a unique name.
718+
oldName + '_' + viewTransitionHostInstanceIdx,
715719
child.memoizedProps,
716720
);
717721
}

0 commit comments

Comments
 (0)