Skip to content

Measure Updated ViewTransition Boundaries #32653

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 7 commits into from
Mar 18, 2025

Conversation

sebmarkbage
Copy link
Collaborator

This does the same thing for measureUpdateViewTransition that we did for measureNestedViewTransitions in e3cbaff. If a boundary hasn't mutated and didn't change in size, we mark it for cancellation. Otherwise we add names to it. The different from the CommitViewTransition path is that the "old" names are added to the clones so this is the first time the "new" names.

Now we also cancel any boundaries that were unchanged. So now the root no longer animates. We still have to clone them. There are other optimizations that can avoid cloning but once we've done all the layouts we can still cancel the running animation and let them just be the regular content if they didn't change. Just like the regular fire-and-forget path.

This also fixes the measurement so that we measure clones by adjusting their position back into the viewport.

This actually surfaces a bug in Safari that was already in #32612. It turns out that the old names aren't picked up for some reason and so in Safari they looked more like a cross-fade than what #32612 was supposed to fix. However, now that bug is even more apparent because they actually just disappear in Safari. I'm not sure what that bug is but it's unrelated to this PR so will fix that separately.

The restore phase should not check the flag. I removed that condition in
the other passes.

We stash previous measurments on "current". We should also clear that same
Fiber.

Also, when we cancel we need to visit the same Fiber we applied names to
in case it changed. In practice this doesn't matter because if it did change
we couldn't cancel it.
…celled

If not cancelled, this is the path that adds the "new" name. Since the
"old" name was only added to the clones, this will be the first time they're
added, even if the HostInstances are shared.
We don't need to hold onto it all the way to the passive commit.
Don't update the button in the fixture optimistically to highlight this.
This allows us to adjust the measurement of the clone which is outside
the viewport as if it was inside of it.
@react-sizebot
Copy link

react-sizebot commented Mar 17, 2025

Comparing: 0237295...0f4abc9

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 = 517.29 kB 517.29 kB = 92.26 kB 92.26 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB +0.05% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js +0.40% 605.66 kB 608.06 kB +0.40% 107.45 kB 107.88 kB
facebook-www/ReactDOM-prod.classic.js +0.08% 652.02 kB 652.54 kB +0.09% 114.84 kB 114.95 kB
facebook-www/ReactDOM-prod.modern.js +0.08% 642.30 kB 642.82 kB +0.09% 113.26 kB 113.36 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-art/cjs/react-art.production.js +1.04% 335.83 kB 339.32 kB +1.10% 56.75 kB 57.38 kB
oss-experimental/react-art/cjs/react-art.development.js +0.57% 631.09 kB 634.70 kB +0.59% 100.08 kB 100.67 kB
oss-experimental/react-reconciler/cjs/react-reconciler.production.js +0.43% 459.48 kB 461.46 kB +0.53% 73.78 kB 74.17 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js +0.40% 605.66 kB 608.06 kB +0.40% 107.45 kB 107.88 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.production.js +0.39% 620.39 kB 622.79 kB +0.40% 111.06 kB 111.50 kB
oss-experimental/react-reconciler/cjs/react-reconciler.profiling.js +0.39% 512.48 kB 514.46 kB +0.52% 81.72 kB 82.15 kB
oss-experimental/react-dom/cjs/react-dom-profiling.profiling.js +0.36% 661.11 kB 663.51 kB +0.34% 116.18 kB 116.58 kB
oss-experimental/react-reconciler/cjs/react-reconciler.development.js +0.29% 755.69 kB 757.90 kB +0.34% 118.85 kB 119.25 kB
oss-experimental/react-dom/cjs/react-dom-client.development.js +0.25% 1,090.21 kB 1,092.88 kB +0.21% 182.42 kB 182.80 kB
oss-experimental/react-dom/cjs/react-dom-profiling.development.js +0.24% 1,106.60 kB 1,109.28 kB +0.21% 185.25 kB 185.64 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.development.js +0.24% 1,107.12 kB 1,109.80 kB +0.20% 186.20 kB 186.57 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer.production.js +0.23% 37.70 kB 37.78 kB +0.09% 7.01 kB 7.01 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer.production.js +0.23% 37.72 kB 37.81 kB +0.07% 7.04 kB 7.04 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer.production.js +0.23% 37.73 kB 37.81 kB +0.07% 7.04 kB 7.04 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-persistent.production.js +0.22% 37.82 kB 37.91 kB +0.10% 7.02 kB 7.03 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-persistent.production.js +0.22% 37.85 kB 37.93 kB +0.07% 7.06 kB 7.06 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-persistent.production.js +0.22% 37.85 kB 37.94 kB +0.07% 7.06 kB 7.06 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer.development.js +0.22% 41.96 kB 42.05 kB +0.08% 7.60 kB 7.61 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer.development.js +0.22% 41.99 kB 42.08 kB +0.07% 7.63 kB 7.64 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer.development.js +0.22% 41.99 kB 42.08 kB +0.08% 7.64 kB 7.64 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-persistent.development.js +0.22% 42.10 kB 42.19 kB +0.09% 7.62 kB 7.63 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-persistent.development.js +0.22% 42.13 kB 42.22 kB +0.08% 7.65 kB 7.66 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-persistent.development.js +0.22% 42.13 kB 42.22 kB +0.08% 7.65 kB 7.66 kB

Generated by 🚫 dangerJS against 0f4abc9

Because we don't use the helpers in CommitHostEffects we have to manually
track whether this caused any mutations for deletions, insertions, hides,
unhides and updates to text content.

Otherwise, we end up canceling boundaries that should've animated.
@sebmarkbage
Copy link
Collaborator Author

sebmarkbage commented Mar 17, 2025

This avoids actually animating the "Swipe me" bar since it doesn't change and its parents doesn't change. That avoids this Safari iOS bug: https://bugs.webkit.org/show_bug.cgi?id=288795

This means that the fixture now works on iOS Beta with the Scroll-driven flag on. In fact, it doesn't even have the bug I mentioned above which I'm observing on Safari Technical Preview on desktop. It is cheating though because really should be able to wrap the SwipeRecognizer around the content that animates.

@sebmarkbage sebmarkbage merged commit 3c3696d into facebook:main Mar 18, 2025
194 checks passed
github-actions bot pushed a commit that referenced this pull request Mar 18, 2025
This does the same thing for  that we did
for  in
e3cbaff.
If a boundary hasn't mutated and didn't change in size, we mark it for
cancellation. Otherwise we add names to it. The different from the
CommitViewTransition path is that the old names are added to the
clones so this is the first time the new names.

Now we also cancel any boundaries that were unchanged. So now the root
no longer animates. We still have to clone them. There are other
optimizations that can avoid cloning but once we've done all the layouts
we can still cancel the running animation and let them just be the
regular content if they didn't change. Just like the regular
fire-and-forget path.

This also fixes the measurement so that we measure clones by adjusting
their position back into the viewport.

This actually surfaces a bug in Safari that was already in #32612. It
turns out that the old names aren't picked up for some reason and so in
Safari they looked more like a cross-fade than what #32612 was supposed
to fix. However, now that bug is even more apparent because they
actually just disappear in Safari. I'm not sure what that bug is but
it's unrelated to this PR so will fix that separately.

DiffTrain build for [3c3696d](3c3696d)
github-actions bot pushed a commit that referenced this pull request Mar 18, 2025
This does the same thing for  that we did
for  in
e3cbaff.
If a boundary hasn't mutated and didn't change in size, we mark it for
cancellation. Otherwise we add names to it. The different from the
CommitViewTransition path is that the old names are added to the
clones so this is the first time the new names.

Now we also cancel any boundaries that were unchanged. So now the root
no longer animates. We still have to clone them. There are other
optimizations that can avoid cloning but once we've done all the layouts
we can still cancel the running animation and let them just be the
regular content if they didn't change. Just like the regular
fire-and-forget path.

This also fixes the measurement so that we measure clones by adjusting
their position back into the viewport.

This actually surfaces a bug in Safari that was already in #32612. It
turns out that the old names aren't picked up for some reason and so in
Safari they looked more like a cross-fade than what #32612 was supposed
to fix. However, now that bug is even more apparent because they
actually just disappear in Safari. I'm not sure what that bug is but
it's unrelated to this PR so will fix that separately.

DiffTrain build for [3c3696d](3c3696d)
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