-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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(useForm): leave formState flags in a consistent state when throwing in handleSubmit onValid #11214
fix(useForm): leave formState flags in a consistent state when throwing in handleSubmit onValid #11214
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
Had problem to run |
…ng in handleSubmit onValid
f2c3da1
to
a3d7507
Compare
thanks for the PR, i think this is what i had before but users complain about errors being swallowed by handleSubmit. |
With this there is still error bubbling up just it set the isSubmitting state before rethrowing the error, no swallow happens |
Since error are not swallowed like before, is there any chance to have this MR merged ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. let me know if you are happy with this as well @Moshyfawn
This is fine as a behaviour fix 👍 |
Thanks a lot for the PR and for your work |
When will this get released? Pardon my ignorance, as I'm a user of the project and not yet a contributor. I stumbled across this issue because I'm experiencing isSubmitting still being true after a rejected promise in the onSubmit handler. |
…owing in handleSubmit onValid (react-hook-form#11214) Co-authored-by: Beier (Bill) <bluebill1049@hotmail.com>
Proposed Changes
onValid function given to handleSubmit from useForm is often the way to send request to server but when this function throw it leave isSubmitting flag true and isSubmitted flag on false what is inconsistent.
This change keep the current behavior of bubbling up the error but fix the inconsistent formState
Fixes #11084
Type of change
Please delete options that are not relevant.
Checklist: