onRest not called when tab isn't visible #1566
-
🐛 Bug ReportI'm not sure whether this is a bug or my lack of knowledge. To ReproduceIn the sandbox: Simply navigate away after refreshing the sandbox, wait for a few seconds. The alert notification doesn't show. Expected behavioronRest 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
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
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? |
Beta Was this translation helpful? Give feedback.
-
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! |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
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?