Skip to content

Make xViewTransitionToHostInstances helpers reusable #32611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 14, 2025

Conversation

sebmarkbage
Copy link
Collaborator

This prepares from being able to reuse some this in ApplyGesture.

These all start with resetting a counter but it's tricky to have to remember to do this and tricky to do from the outside of this module. So we make an exported helper that does the resetting. Ideally it gets inlined.

We also stop passing "current" to measureViewTransitionHostInstances. Same thing for cancelViewTransitionHostInstances. This doesn't make sense for "nested" which has not updated and so might not have an alternate. Instead we pass in the old and new name if they might be different.

These all start with resetting a counter but it's tricky to have to
remember to do this and tricky to do from the outside of this module.
So we make an exported helper that does the resetting. Ideally it gets
inlined.
@react-sizebot
Copy link

react-sizebot commented Mar 14, 2025

Comparing: f3c9560...2d1a79b

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.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 518.75 kB 518.75 kB = 92.47 kB 92.46 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 591.76 kB 591.62 kB +0.07% 105.36 kB 105.43 kB
facebook-www/ReactDOM-prod.classic.js = 652.39 kB 652.25 kB +0.07% 114.72 kB 114.80 kB
facebook-www/ReactDOM-prod.modern.js = 642.71 kB 642.56 kB +0.07% 113.15 kB 113.23 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-semver/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js = 2,268.31 kB 2,260.98 kB = 358.98 kB 358.08 kB
oss-stable/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js = 2,268.31 kB 2,260.98 kB = 358.98 kB 358.08 kB
oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js = 2,595.77 kB 2,587.37 kB = 370.62 kB 369.65 kB
oss-stable-semver/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js = 2,595.58 kB 2,587.19 kB = 370.60 kB 369.62 kB
oss-stable/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js = 2,595.58 kB 2,587.19 kB = 370.60 kB 369.62 kB
oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js = 2,268.52 kB 2,260.28 kB = 359.01 kB 358.05 kB

Generated by 🚫 dangerJS against 8cebae4

Same thing for cancelViewTransitionHostInstances

This doesn't make sense for "nested" which has not updated and so might not
have an alternate. Instead we pass in the old and new name if they might
be different.
…sh/pop pattern

This was moved to be a setter when it was extracted to another module but
really it should be treated as push/pop.
Copy link
Member

@rickhanlonii rickhanlonii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@sebmarkbage sebmarkbage merged commit 6daef4e into facebook:main Mar 14, 2025
194 checks passed
sebmarkbage added a commit that referenced this pull request Mar 14, 2025
Stacked on #32599 and #32611.

This is able to reuse the code from CommitViewTransitions for "enter",
"shared" and "layout". The difference is that for "enter"/"shared" in
the "new" phase we pass in the deletions.

For "layout" of nested boundaries we just need to measure the clones at
the same time we measure the original nodes since we haven't measured
them in a previous phase in the current approach.

With these updates, things move around more like expected in the fixture
because we're now applying the appropriate pairs to trigger individual
animations instead of just the full document cross-fade.

The "update" phase is a little more complicated and is coming soon.
github-actions bot pushed a commit that referenced this pull request Mar 14, 2025
Stacked on #32599 and #32611.

This is able to reuse the code from CommitViewTransitions for "enter",
"shared" and "layout". The difference is that for "enter"/"shared" in
the "new" phase we pass in the deletions.

For "layout" of nested boundaries we just need to measure the clones at
the same time we measure the original nodes since we haven't measured
them in a previous phase in the current approach.

With these updates, things move around more like expected in the fixture
because we're now applying the appropriate pairs to trigger individual
animations instead of just the full document cross-fade.

The "update" phase is a little more complicated and is coming soon.

DiffTrain build for [2c56037](2c56037)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants