Properly clean up gesture Animations#35559
Merged
sebmarkbage merged 1 commit intofacebook:mainfrom Jan 20, 2026
Merged
Conversation
|
Comparing: 195fd22...b6c2630 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
|
Good Work |
maxine-yx
reviewed
Jan 19, 2026
maxine-yx
left a comment
There was a problem hiding this comment.
Overall looks good! The fix properly handles animation cleanup.
There was a problem hiding this comment.
Great fix! This properly tracks the animation for cleanup.
| rangeStart: (reverse ? rangeEnd : rangeStart) + '%', | ||
| rangeEnd: (reverse ? rangeStart : rangeEnd) + '%', | ||
| }); | ||
| viewTransitionAnimations.push(animation); |
There was a problem hiding this comment.
Good addition - this ensures the animation is tracked for proper cleanup.
acdlite
approved these changes
Jan 20, 2026
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
added a commit
that referenced
this pull request
Jan 20, 2026
Follow up to #35559. The clean up function of the custom timeline doesn't necessarily clean up the animation. Just the timeline's internal state. This affects Firefox which doesn't support ScrollTimeline so uses the polyfill's custom timeline.
sebmarkbage
pushed a commit
to vercel/next.js
that referenced
this pull request
Jan 20, 2026
[diff facebook/react@41b3e9a6...d2908752](facebook/react@41b3e9a...d290875) <details> <summary>React upstream changes</summary> - facebook/react#35567 - facebook/react#35566 - facebook/react#35565 - facebook/react#35564 - facebook/react#35559 - facebook/react#35556 </details>
github-actions Bot
pushed a commit
to shlomiNugarker/react
that referenced
this pull request
Jan 20, 2026
Follow up to facebook#35559. The clean up function of the custom timeline doesn't necessarily clean up the animation. Just the timeline's internal state. This affects Firefox which doesn't support ScrollTimeline so uses the polyfill's custom timeline. DiffTrain build for [d290875](facebook@d290875)
github-actions Bot
pushed a commit
to shlomiNugarker/react
that referenced
this pull request
Jan 20, 2026
Follow up to facebook#35559. The clean up function of the custom timeline doesn't necessarily clean up the animation. Just the timeline's internal state. This affects Firefox which doesn't support ScrollTimeline so uses the polyfill's custom timeline. DiffTrain build for [d290875](facebook@d290875)
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.
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.