Has anyone seen isSubmitting=false when you submit? I can't replicate this anywhere except my project. The codesandbox is the same exact environment I'm running my project on except this works.
https://codesandbox.io/s/formik-issubmitting-working-h0mxc?file=/src/App.js
Are you using async or returning a Promise in your other environment? async/promise-based submit callbacks will set isSubmitting back to true automatically after they resolve.
You can see the spinner is never spun here:
https://codesandbox.io/s/formik-issubmitting-working-nxfsd
Are you using async or returning a Promise in your other environment? async/promise-based submit callbacks will set isSubmitting back to true automatically after they resolve.
You can see the spinner is never spun here:
https://codesandbox.io/s/formik-issubmitting-working-nxfsd
Thanks john! This makes sense. Because it resolved right away, it looked like it was never set to true. I've tested this and it's working as expected. Thanks again!
Are you using async or returning a Promise in your other environment? async/promise-based submit callbacks will set isSubmitting back to true automatically after they resolve.
You can see the spinner is never spun here:
https://codesandbox.io/s/formik-issubmitting-working-nxfsd
@johnrom
Came here for the same issue.
The sandbox does not work for me. I don't see the button disabled neither the spinner.
Are you using async or returning a Promise in your other environment? async/promise-based submit callbacks will set isSubmitting back to true automatically after they resolve.
You can see the spinner is never spun here:
https://codesandbox.io/s/formik-issubmitting-working-nxfsd@johnrom
Came here for the same issue.
The sandbox does not work for me. I don't see the button disabled neither the spinner.
The sandbox is an example of what _doesn't work_. It's an async function which completes instantly, which means it automatically sets submitting back to false.
If you remove async it will work. Or you can create a Promise to await within the async function. If it's sync and doesn't return a promise, you'll have to setSubmitting false yourself; it'll automatically flip back when an async call or Promise completes.
Just commenting here to say how I solved a similar issue with my code, I had accidentally left async in the onSubmit function signature, removing it resolved my issue.
Most helpful comment
Just commenting here to say how I solved a similar issue with my code, I had accidentally left
asyncin theonSubmitfunction signature, removing it resolved my issue.