-
Notifications
You must be signed in to change notification settings - Fork 39
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
bug: rive animations can get "stuck" in a stopped rendering state due to IntersectionObserver
#257
Comments
IntersectionObserver
Hey! Can you share some basic steps to reproduce it? |
Linking our thread in the community: As mentioned there, we've noticed it when reordering DOM elements, resizing the window, leaving and coming back to the tab... sometimes it seems to happen without any apparent explanation. |
The code we think is causing the problem: rive-react/src/hooks/useRive.tsx Lines 150 to 164 in 8bb5652
|
Have the same problem Rive animation should be anywhere, but out of viewport for the first render. UPD: if it's not enough to understand the prob, let me know and I will share a real life example of this bug |
We've tracked a nasty race condition down in our product that ultimately we determined was caused by rive-react's usage of the
IntersectionObserver
to pause rendering while canvases are occluded.In certain circumstances, this effect can cause the canvas to get "stuck" in a stopped-rendering state. Simply running
startRendering()
on a canvas in this state fixes the issue.Our temporary workaround is to call
startRendering()
periodically every 100ms to ensure these get un-stuck. However, obviously, this should be fixed...The text was updated successfully, but these errors were encountered: