-
Notifications
You must be signed in to change notification settings - Fork 50.4k
Properly clean up gesture Animations #35559
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
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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good! The fix properly handles animation cleanup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good addition - this ensures the animation is tracked for proper cleanup.
…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>`.
…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)
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.
[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>
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.