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

Change isSubmitting behaviour to mimic v1 #1987

Merged

Conversation

Tigge
Copy link
Contributor

@Tigge Tigge commented Nov 2, 2019

In version 2 the behaviour of isSubmitting was changed from having the
user handle its state after submitting to always resetting it to false
after the onSubmit handler had returned (or it's promise). This reverts
it back to the version 1 behaviour of not touching the isSubmitting
state after the onSubmit handler has been called.

Solves: #1957

@Tigge Tigge mentioned this pull request Nov 2, 2019
@AllenAnthes
Copy link

I agree that the lack of docs around this change was definitely unfortunate but it does appear to fix a longstanding issue (#486) that prevented chaining functions onto submitForm (for example showing loading/submission state on a button).

That being said, the above only applies to returning a promise from submitForm, not the automatic setting of isSubmitting

@vercel
Copy link

vercel bot commented Nov 8, 2019

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/jared/formik-docs/398l3myot
🌍 Preview: https://formik-docs-git-fork-tigge-reset-issubmitting-behaviour-to-v1.jared.now.sh

@Tigge
Copy link
Contributor Author

Tigge commented Nov 8, 2019

@AllenAnthes yeah, the promise behaviour could certainly be kept as well in this PR. I've updated it accordingly.

@rofazayn
Copy link

rofazayn commented Nov 8, 2019

@Tigge, Who can we contact to merge this? Is there a way I could fix this myself by editing my local Formik files?

Sorry for the dumb question, I am a noob x)

@Tigge
Copy link
Contributor Author

Tigge commented Nov 8, 2019

@rofazayn that's @jaredpalmer - I'm sure he'll get around to addressing this eventually. For now, if you want to test, you might be able to do it using https://docs.npmjs.com/files/package.json#git-urls-as-dependencies by point to my branch.

@numToStr
Copy link

Why it is not yet merged? I think everyone's form is working fine.

In version 2 the behaviour of isSubmitting was changed from having the
user handle its state after submitting to always resetting it to false
after the onSubmit handler had returned (or it's promise).

This adds back to the version 1 behaviour of not touching the
isSubmitting state after the onSubmit handler has been called if we
don't return a promise in the onSubmit handler.

Solves: jaredpalmer#1957
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.

None yet

5 participants