react-joyride icon indicating copy to clipboard operation
react-joyride copied to clipboard

Can't perform a React state update on an unmounted component (resizeListener)

Open rakid opened this issue 7 years ago • 0 comments

🐛 Bug Report

When I have a parent component who listen to resize event, and then I return null instead of returning joyride if size is lower than 800px Then I have a warning : Can't perform a React state update on an unmounted component.

To Reproduce

include Joyride in a component who listen to window resize, and then make a condition in render like if (width < 800) return null instead of return <Joyride {...props} />

Expected behavior

All listeners must be removed, including timeout functions like resizeTimeout after unmouting joyRide:

https://github.com/gilbarbara/react-joyride/blob/5a2218694aa5744dc07d73ea72a96f4b068c20e0/src/components/Overlay.js#L140

because when the this.forceUpdate() is invoked, the component doesn't exist anymore.

rakid avatar Apr 10 '19 20:04 rakid