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

Fix reset in onSubmit #363

Merged
merged 2 commits into from
Oct 23, 2020
Merged

Fix reset in onSubmit #363

merged 2 commits into from
Oct 23, 2020

Conversation

bertho-zero
Copy link
Contributor

Closes #362, related to #229.

@bertho-zero bertho-zero changed the title fix: fix reset in onSubmit Fix reset in onSubmit Jul 2, 2020
@mhmdAljefri mhmdAljefri requested a review from erikras July 7, 2020 16:10
@erikras erikras merged commit 79986e3 into final-form:master Oct 23, 2020
@@ -930,7 +930,7 @@ function createForm<FormValues: FormValuesShape>(

reset: (initialValues = state.formState.initialValues) => {
if (state.formState.submitting) {
throw Error('Cannot reset() in onSubmit(), use setTimeout(form.reset)')
state.formState.resetWhileSubmitting = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that you should return after state.formState.resetWhileSubmitting = true;, no?

@erikras
Copy link
Member

erikras commented Mar 5, 2021

Released in v4.20.2.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reset while onSubmit
3 participants