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

Prevent setState calls in submit if unmounted after validation #861

Merged
merged 2 commits into from
Aug 30, 2018

Conversation

jaredpalmer
Copy link
Owner

@jaredpalmer jaredpalmer commented Aug 30, 2018

Fixes #854 by checking for this.didMount after async validation is done

@jaredpalmer
Copy link
Owner Author

@chasecaleb does this work?

@chasecaleb
Copy link

I think it should actually be this:

if (isValid) {
    this.executeSubmit();
} else if (this.didMount) {
    this.setState({ isSubmitting: false });
}

That way the submit will still happen when unmounted, but without the broken call to setState().

@jaredpalmer jaredpalmer changed the title Fix #854. Prevent setState calls in submit if unmounted after validation Prevent setState calls in submit if unmounted after validation Aug 30, 2018
@jaredpalmer
Copy link
Owner Author

Will cut a release when this passes.

@jaredpalmer jaredpalmer merged commit 01f852e into master Aug 30, 2018
@jaredpalmer jaredpalmer deleted the bugfix/prevent-unmount-setstate branch August 30, 2018 20:44
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