Skip to content

Conversation

@sebmarkbage
Copy link
Collaborator

This is like the onEnter/Exit/Share/Update events but for gestures. It allows manually controlling the animation using the passed timeline.

@meta-cla meta-cla bot added the CLA Signed label Jan 19, 2026
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Jan 19, 2026
@react-sizebot
Copy link

react-sizebot commented Jan 19, 2026

Comparing: 195fd22...d3e4329

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 +0.05% 1.88 kB 1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 608.48 kB 608.48 kB = 107.60 kB 107.60 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 +0.28% 670.95 kB 672.85 kB +0.23% 118.02 kB 118.30 kB
facebook-www/ReactDOM-prod.classic.js = 693.87 kB 693.87 kB = 121.98 kB 121.98 kB
facebook-www/ReactDOM-prod.modern.js = 684.25 kB 684.25 kB = 120.37 kB 120.37 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 +0.44% 358.82 kB 360.40 kB +0.38% 60.39 kB 60.62 kB
oss-experimental/react-reconciler/cjs/react-reconciler.production.js +0.43% 491.86 kB 493.95 kB +0.37% 78.14 kB 78.43 kB
oss-experimental/react-reconciler/cjs/react-reconciler.profiling.js +0.37% 568.03 kB 570.12 kB +0.33% 88.37 kB 88.65 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js +0.28% 670.95 kB 672.85 kB +0.23% 118.02 kB 118.30 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.production.js +0.28% 685.36 kB 687.26 kB +0.21% 121.56 kB 121.82 kB
oss-experimental/react-reconciler/cjs/react-reconciler.development.js +0.25% 862.57 kB 864.76 kB +0.25% 134.34 kB 134.67 kB
oss-experimental/react-dom/cjs/react-dom-profiling.profiling.js +0.25% 750.23 kB 752.13 kB +0.21% 129.57 kB 129.84 kB
oss-experimental/react-art/cjs/react-art.development.js +0.25% 734.08 kB 735.91 kB +0.23% 115.50 kB 115.76 kB

Generated by 🚫 dangerJS against d3e4329

This is like the onEnter/Exit/Share/Update events but for gestures.
It allows manually controlling the animation using the passed timeline.
}
for (let i = 0; i < pendingEvents.length; i++) {
const viewTransitionEvent = pendingEvents[i];
viewTransitionEvent(pendingTypes);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This calls user code. Does it need to be wrapped in error handling? Didn't see where else that might be happening.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think these are similar to onRecoverableError. I don't think they're handled properly in the existing one in flushSpawnedWork is right neither.

The way these phases flush is that they keep mutable state so that they can pick up and flush remaining phases if one is missed. So if this errors, then it errors the view transition which then flushes the remaining work which flushes the previous work but it doesn't flush this again so it probably misses anything after this. That means that bugs in React code might not be properly handled.

However, to ensure that other callbacks are handled, these should probably be wrapped in try/catch for each callback so that they're independently handled. Same thing for onRecoverableError.

There's also a question of what the default priority and execution context should be for these.

@sebmarkbage sebmarkbage merged commit 4bcf67e into facebook:main Jan 20, 2026
234 checks passed
sebmarkbage added a commit that referenced this pull request Jan 20, 2026
Follow up to #35337.

During a gesture, we always cancel the original animation and create a
new one that we control. That's the one we need to add to the set that
needs to be cancelled. Otherwise future gestures hang.

An unfortunate consequence is that any custom ones that you start e.g.
with #35556 or through other means aren't automatically cleaned up (in
fact there's not even a clean up callback yet). This can lead these to
freeze the whole UI afterwards. It would be really good to get this
fixed in browsers instead so we can revert #35337.
sebmarkbage added a commit that referenced this pull request Jan 20, 2026
…ts (#35564)

Stacked on #35556 and #35559.

Given that we don't automatically clean up all view transition
animations since #35337 and browsers are buggy, it's important that you
clean up any `Animation` started manually from the events. However,
there was no clean up function for when the View Transition is forced to
stop. This also makes it harder to clean up custom timers etc too.

This lets you return a clean up function from all the events on
`<ViewTransition>`.
github-actions bot pushed a commit that referenced this pull request Jan 20, 2026
…ts (#35564)

Stacked on #35556 and #35559.

Given that we don't automatically clean up all view transition
animations since #35337 and browsers are buggy, it's important that you
clean up any `Animation` started manually from the events. However,
there was no clean up function for when the View Transition is forced to
stop. This also makes it harder to clean up custom timers etc too.

This lets you return a clean up function from all the events on
`<ViewTransition>`.

DiffTrain build for [c55ffb5](c55ffb5)
@sebmarkbage
Copy link
Collaborator Author

cc @eps1lon for DefinitelyTyped

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.

3 participants