Skip to content

Add enableViewTransitionForPersistenceMode dynamic feature flag#36014

Open
zeyap wants to merge 8 commits into
react:mainfrom
zeyap:enable-vt-persistence-mode
Open

Add enableViewTransitionForPersistenceMode dynamic feature flag#36014
zeyap wants to merge 8 commits into
react:mainfrom
zeyap:enable-vt-persistence-mode

Conversation

@zeyap

@zeyap zeyap commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds enableViewTransitionForPersistenceMode dynamic feature flag (defaults to false in all channels)
  • In applyViewTransitionToHostInstancesRecursive and measureViewTransitionHostInstancesRecursive, when it's persistence mode and enableViewTransitionForPersistenceMode==true, run applyViewTransitionName recursively
    • will build on top and add measureInstance related logic when it makes sense (see the TODOs inline)

Test plan

  • Existing view transition tests pass (flag is false by default, so no behavior change)
  • yarn flow for dom-node, fabric, native renderers
  • Check before vs after for ReactFabric-dev.fb.js and React-dev.js with the viewtransition featureflags default - nothing changes

@react-sizebot

react-sizebot commented Mar 11, 2026

Copy link
Copy Markdown

Comparing: d594643...a0ed77d

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 612.81 kB 612.81 kB = 108.29 kB 108.29 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 678.75 kB 678.75 kB = 119.25 kB 119.25 kB
facebook-www/ReactDOM-prod.classic.js = 698.14 kB 698.14 kB = 122.65 kB 122.65 kB
facebook-www/ReactDOM-prod.modern.js = 688.45 kB 688.45 kB = 121.03 kB 121.02 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
react-native/implementations/ReactFabric-profiling.fb.js +0.71% 492.27 kB 495.75 kB +0.71% 82.92 kB 83.51 kB
react-native/implementations/ReactFabric-prod.fb.js +0.67% 409.60 kB 412.35 kB +0.70% 71.03 kB 71.52 kB
react-native/implementations/ReactFabric-dev.fb.js +0.52% 810.73 kB 814.94 kB +0.51% 129.72 kB 130.39 kB

Generated by 🚫 dangerJS against a0ed77d

@zeyap zeyap changed the title Add enableViewTransitionForPersistenceMode feature flag Add dynamic enableViewTransitionForPersistenceMode feature flag Mar 19, 2026
@zeyap zeyap changed the title Add dynamic enableViewTransitionForPersistenceMode feature flag Add enableViewTransitionForPersistenceMode dynamic feature flag Mar 19, 2026
@jackpope

Copy link
Copy Markdown
Collaborator

I believe what @rickhanlonii meant in #35764 (comment) was to create an exported flag from the config itself. Just like how we have supportsHydration we can have supportsViewTransition https://github.com/facebook/react/blob/main/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js#L3762

zeyap added 8 commits March 19, 2026 15:00
Wherever the reconciler checks supportsMutation before running view
transition logic, add an else-if branch gated on
enableViewTransitionForPersistenceMode for persistent renderers (Fabric).

This follows the pattern that supportsMutation guards mutation-mode-only
logic, and persistent mode should have its own branch rather than being
lumped under a single supportsViewTransition capability flag.

For now the persistent mode branches duplicate the mutation logic.
The flag defaults to false in all channels.
Remove viewport measurement and cancelable children tracking for
persistence mode paths, deferring viewport calculation to a future TODO.
Remove duplicate restoreRootViewTransitionName call and deduplicate
feature flag import.
@zeyap zeyap force-pushed the enable-vt-persistence-mode branch from 59725a1 to a0ed77d Compare March 19, 2026 19:01
@zeyap

zeyap commented Mar 19, 2026

Copy link
Copy Markdown
Contributor Author

I believe what @rickhanlonii meant in #35764 (comment) was to create an exported flag from the config itself. Just like how we have supportsHydration we can have supportsViewTransition https://github.com/facebook/react/blob/main/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js#L3762

@jackpope oh Rick replied offline since I last attempted to add that supportsViewTransition:

actually now that i think about it, i think you will need a new flag separate from enableViewTransition for this. something like enableNativeViewTransition. two reasons:

- you need to gate all the supportsViewTransition logic
- we're ready to remove enableViewTransition.
you can make a flag dynamic, which allows you to control it with a GK

but I guess i can achieve the same with dynamic config flag

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

@github-actions github-actions Bot added the Resolution: Stale Automatically closed due to inactivity label Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Resolution: Stale Automatically closed due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants