pmndrs / react-spring

✌️ A spring physics based React animation library
http://www.react-spring.dev/
MIT License
28.25k stars 1.19k forks source link

[bug]: Browser freeze with prop change in nested animations #1831

Open remiremi opened 2 years ago

remiremi commented 2 years ago

Which react-spring target are you using?

What version of react-spring are you using?

9.4.2

What's Wrong?

I have an animated loop rotating a container, contained in an animated loop moving the container.

The animation sometimes randomly freezes the browser, which prompts me to stop the webpage.The console indicates the script got stopped in the flushUpdate method.

To Reproduce

See codesandbox. Doesn't freeze every time, but if you click the box a couple of times it should freeze.

I think the root cause is that there is an outer animation, with an inner animation that has a loop. I tried splitting the animated.div component in two separate nested components, one for the translation and one for the rotation, but the result is the same: browser ends up freezing.

Tried on Firefox only.

Expected Behaviour

Browser should never freeze.

Link to repo

https://codesandbox.io/s/interesting-raman-p8y5j?file=/src/index.js

ClishWang commented 2 years ago

I have the same problem,when the "document.hidden = true" animations will blocked. countdown behavior to be confused.

joshuaellis commented 1 year ago

I think this is related to #1882

Lonli-Lokli commented 1 week ago

So if it's reproduced - can it be fixed?

joshuaellis commented 1 week ago

When someone has the time to look, sure!