-
-
Notifications
You must be signed in to change notification settings - Fork 348
forceUpdate warning if component is unmounted by componentWillReact #73
Comments
Hi Tim, Version |
Yep, that did it! Thanks for looking into and fixing this, @mweststrate! |
Hmm actually I am wondering whether
This no longer changes the routing as side effect of a rendering, but instead as a side effect of changing the |
Ah, I didn't know about The only reason I didn't use |
yes both return a function to clean up Op do 14 jul. 2016 17:23 schreef Tim Dorr notifications@github.com:
|
That's what wasn't clear. I'll see about a PR for some docs improvements around that. In that case, I would treat |
I was implementing some auth logic in my app and ran into some of the wonderful
forceUpdate
errors I'm sure you hate at this point.The cause of this was my checking for authorization changes within
componentWillReact
, looking to see if I was now logged out/in and redirecting to/from the login screen. Basically, I had something like this in on my top-levelApp
wrapper component:(BTW, I'm using the new
Provider
component for this. Super helpful!)This created a side effect of having my redirect unmount the
App
component (It will switch to another top-level tree with myLogin
component). This side effect isn't checked for theforceUpdate
call directly after the lifecycle method runs.I haven't checked out the project and set things up to run tests, otherwise this would be a PR. But I believe this will fix the issue:
I don't know how stable the
_calledComponentWillUnmount
property will be over time. It was only added in 15.0.2, so you probably want to DIY for older versions. You can do something similar to #44, but only tracking ifcomponentDidUnmount
was called.The text was updated successfully, but these errors were encountered: