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

Do not call setState if the component has already been unmounted #35

Merged
merged 1 commit into from
Jan 26, 2017

Conversation

bmac
Copy link
Contributor

@bmac bmac commented Jan 25, 2017

I have a component that navigates away from the page immediately after a successful async action. As a result I was seeing the following warning in the console: "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 AsyncButton component.".

This pr changes it so setState is never called asynchronously if the component was unmounted before the promise resolves or rejects.

@selvagsz selvagsz merged commit 913bb1a into selvagsz:master Jan 26, 2017
@selvagsz
Copy link
Owner

@bmac thanks. Published 0.0.6

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.

2 participants