Enable ViewTransition onUpdate for persistence mode (Fabric)#36363
Open
zeyap wants to merge 1 commit intofacebook:mainfrom
Open
Enable ViewTransition onUpdate for persistence mode (Fabric)#36363zeyap wants to merge 1 commit intofacebook:mainfrom
zeyap wants to merge 1 commit intofacebook:mainfrom
Conversation
In persistence mode (React Native Fabric), host component updates are performed as clones during the render phase (completeWork) rather than as mutations during commit. This caused two issues preventing ViewTransition's onUpdate callback from firing: 1. The Cloned flag was not included in BeforeAndAfterMutationTransitionMask, so the before-mutation traversal never descended into subtrees with persistence-mode clones. This meant shouldStartViewTransition was never set, startViewTransition was never called, and flushAfterMutationEffects never ran. 2. trackHostMutation() was never called for persistence-mode clones, so viewTransitionMutationContext stayed false and the Update flag was never set on ViewTransition fibers during commit. This adds Cloned to BeforeAndAfterMutationTransitionMask (gated behind enableViewTransitionForPersistenceMode) and introduces commitHostCloned() in ReactFiberCommitHostEffects to track persistence-mode mutations for ViewTransition detection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ClonedtoBeforeAndAfterMutationTransitionMask(gated behindenableViewTransitionForPersistenceMode) so the before-mutation phase traverses into subtrees where persistence-mode clones occurred, allowingshouldStartViewTransitionto be set andflushAfterMutationEffectsto runcommitHostCloned()inReactFiberCommitHostEffectsto calltrackHostMutation()for persistence-mode clones, soviewTransitionMutationContextis set and theUpdateflag gets applied to parentViewTransitionfibers during commitRoot Cause
In persistence mode (Fabric), host component updates happen via
cloneInstanceduring the render phase (completeWork), not viacommitUpdateduring commit. The view transition system relied on two mutation-mode-only mechanisms:BeforeAndAfterMutationTransitionMaskdidn't includeCloned, so the before-mutation traversal skipped subtrees with only persistence-mode changes —startViewTransitionwas never called andflushAfterMutationEffectsnever rantrackHostMutation()was only called from mutation-mode commit paths (commitHostUpdate,commitHostTextUpdate), soviewTransitionMutationContextstayedfalseand theUpdateflag was never set onViewTransitionfibersTest plan
onUpdatefires onViewTransitioncomponents in React Native Fabric when child host components updateenableViewTransitionForPersistenceModeandsupportsPersistence)