svelte-forms-lib
svelte-forms-lib copied to clipboard
fix(create-form.js): fix onSubmit rejection being ignored when using 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.
It looks like the build partially failed for the node version which I assume is the latest. The test suite looks ok.