svelte-forms-lib icon indicating copy to clipboard operation
svelte-forms-lib copied to clipboard

fix(create-form.js): fix onSubmit rejection being ignored when using validationSchema

Open dlebech opened this issue 3 years ago • 1 comments

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 avatar May 12 '22 16:05 dlebech

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

dlebech avatar May 12 '22 16:05 dlebech