You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When conditionally rendering a Node, sometimes the Node will be unmounted to be replaced by another one.
When this happens, the Node's componentWillUnmount method is called, followed by it's own children.
When this happens, it's not possible for it's own children to unmount because when Node.famousDelete is called, the _famousNode of the _famousParent is already unmounted!
When SplashScreen is used in another component, like this:
// This must contain React components that extend from react-famous/Nodeletloginlayouts={
SplashScreen, SignUpScreen, LoginScreen
}classLoginextendsNode{render(){return(<Node_famousParent={this}id="rootNode">{React.createElement(this.data.loginLayout)}</Node>)}getMeteorData(){console.log('login root data changed.')return{loginLayout: loginlayouts[Session.get('loginlayout')]}}}reactMixin(Login.prototype,ReactMeteorData)exportdefaultLogin
then, when the value of this.data.loginLayout changes (and Meteor forces the component to update), the SplashScreen can be unmounted and replaced by another component from the loginlayouts object, and when that happens, I notice the error: SplashScreen's componentWillUnmount method is called, then SplashScreen's rootNode's componentWillUnmount method is called. Since SplashScreen was unmounted first, the call to rootNode's componentWillUnmount fails because there's no _famousParent._famousNode to unmount from.
The text was updated successfully, but these errors were encountered:
Is it possible to change the order of React's calls to componentWillUnmount so that children unmount first? If not, a simple solution may be to add the following check into Node.famousDelete:
before using react-famous/Node, and it works great.
trusktr
changed the title
[mixed-mode] [bug] componentWillUnmount calls are in reverse order.
[mixed-mode] [react-bug] componentWillUnmount calls are in reverse order.
Sep 1, 2015
When conditionally rendering a Node, sometimes the Node will be unmounted to be replaced by another one.
When this happens, the Node's componentWillUnmount method is called, followed by it's own children.
When this happens, it's not possible for it's own children to unmount because when
Node.famousDelete
is called, the _famousNode of the _famousParent is already unmounted!For example, I've got a class like this:
When
SplashScreen
is used in another component, like this:then, when the value of
this.data.loginLayout
changes (and Meteor forces the component to update), the SplashScreen can be unmounted and replaced by another component from theloginlayouts
object, and when that happens, I notice the error: SplashScreen's componentWillUnmount method is called, then SplashScreen'srootNode
's componentWillUnmount method is called. Since SplashScreen was unmounted first, the call to rootNode's componentWillUnmount fails because there's no _famousParent._famousNode to unmount from.The text was updated successfully, but these errors were encountered: