Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid calling setState when component is being unmounted #156

Merged
merged 1 commit into from
May 12, 2015

Conversation

mridgway
Copy link
Collaborator

This avoids an issue where you have a parent and a child both listening to the same store, where parent could re-render in the middle of handling the change event causing the child to be unmounted. When this happens, the child's call to setState will cause a warning.

It's important to note here that the isMounted() may be removed in the future: https://facebook.github.io/react/docs/component-api.html#ismounted. If this happens we will either need to implement our own flag (using componentWillUnmount) or hope that an alternative is found. See facebook/react#2787 for discussion on this warning and whether it's needed or not.

Also fixes YahooArchive/fluxible-router#18

@yahoocla
Copy link

CLA is valid!

@jedireza
Copy link
Contributor

👍

mridgway added a commit that referenced this pull request May 12, 2015
Avoid calling setState when component is being unmounted
@mridgway mridgway merged commit f1fdf2a into master May 12, 2015
@mridgway mridgway deleted the avoidUnmountedSetState branch May 12, 2015 17:56
@geekyme
Copy link
Contributor

geekyme commented May 13, 2015

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Getting cryptic setState warnings on the console with <NavLink />
4 participants