Skip to content

Don't set state if unmounted during dispatch #96

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

Merged
merged 1 commit into from
Sep 6, 2015

Conversation

gaearon
Copy link
Contributor

@gaearon gaearon commented Sep 6, 2015

Previously, if you unmount the component during the dispatch cycle, the component itself is still going to receive the next state, call mapStateToProps, and attempt to call setState. This resulted in a warning by React that we're setting state on an unmounted component.

With this change, we bail out from handling any state changes if we have unsubscribed. Fixes #92, #95.

gaearon added a commit that referenced this pull request Sep 6, 2015
Don't set state if unmounted during dispatch
@gaearon gaearon merged commit a440b6e into master Sep 6, 2015
@gaearon gaearon deleted the dont-setstate-when-unmounted branch September 6, 2015 23:38
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.

1 participant