Closed misaelgaray closed 3 years ago
Hi @misaelgaray Thanks for the detailed explanation.
I hope I found the problem.
I use requestAnimationFrame
as an optimization to not overload components with onResize
events.
But according to the raf specification:
requestAnimationFrame() calls are paused in most browsers when running in background tabs or hidden
After some thoughts, I decided to remove this optimization from the module. I can imagine many different situations when you need to trigger resize events in the background and it's weird that we haven't found this problem earlier.
Should be fixed in v6.2.0
Let me know if it doesn't work. Closing the issue
I'm using the hoc withResizeDetector in a component which takes a while to be mounted (Is rendered after an async task finishes). Once mounted the state is updated in componentDidMount calling componentDidUpdate where I want to use the with and height. The issue is that if I'm not in the browser tab, or if the browser is minimized, or browser is in other windows desktop when the componentDidUpdate is reached then the size data (width, height, ref) is undefined.
Its also undefined in componentDidMount although I don't need the size data there. Using Chrome, Opera and last versions of react-resize-detector. Thanks.