onRest not called when tab isn't visible
🐛 Bug Report
I'm not sure whether this is a bug or my lack of knowledge. onRest doesn't get called when tab isn't visible, which causes the animation life cycle to be interrupted until the user returns to the tab.
To Reproduce
In the sandbox:
Simply navigate away after refreshing the sandbox, wait for a few seconds. The alert notification doesn't show.
Expected behavior
onRest should get called (the alert should be triggered in the background)
Link to repro (highly encouraged)
https://codesandbox.io/s/angry-oskar-egl0f?file=/src/App.js
Environment
react-springv9.2.3reactv17.x.x
This feels OOS for react-spring at current. We use requestAnimationFrame which be design of the web API doesn't not fire when the tab is not visible... we could have an option in the config if you're interested in implementing this feature?
I see, so it is by design that the events don't fire when a tab isn't visible. I will work around it for my use case and see if i can allocate time to implement this myself, depending on how complex it would be. Thanks for the quick response!
I'd say it's a web standard over being by design. I believe there's another API that will assist you in understanding of the tab is not visible. You could potential use that, implementing finishing when that happens (short fusing the animation so to speak) would be the feature implementation