-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
I came across the following Warning in my app
Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the StatefulDashboard component.
and on farther inspection it appears my Dashboard component, which had already unmounted was connected to a store that had been modified. The connectToStores#onChange was called, which in turn called this.setState(...), resulting in the above Warning message.
I'm thinking an isMounted() check would be applicable in the onChange method:
onChange: function onChange() {
if ( this.isMounted() ) {
this.setState(Spec.getPropsFromStores(this.props, this.context));
}
},
Updating like so resolves the issue on my end. Let me know if you agree, and I can create a PR
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels