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(create-form.js): fix onSubmit rejection being ignored when using validationSchema #167

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dlebech
Copy link
Contributor

@dlebech dlebech commented May 12, 2022

This commit fixes an issue that occurs when using yup validation
schema and an onSubmit function that rejects.

In this case, the rejection is completely ignored, because because
handleSubmit has a .catch() function that assumes the error is from yup.

The fix is to change the catch to a then and use both the onFulfilled and
onRejected handlers
, depending on whether validation failed or not.

…validationSchema

This commit fixes an issue that occurs when using yup validation
schema and an onSubmit function that rejects.

In this case, the rejection is completely ignored, because because
handleSubmit has a .catch() function that assumes the error is from yup.

The fix is to change the catch to a then and use both the onFulfilled and
onRejected handlers, depending on whether validation failed or not.
@dlebech
Copy link
Contributor Author

dlebech commented May 12, 2022

It looks like the build partially failed for the node version which I assume is the latest. The test suite looks ok.

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

1 participant