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

handleSubmit does not return promise from onSubmit #152

Closed
dlebech opened this issue Dec 29, 2021 · 2 comments · Fixed by #153
Closed

handleSubmit does not return promise from onSubmit #152

dlebech opened this issue Dec 29, 2021 · 2 comments · Fixed by #153
Labels
bug Something isn't working released

Comments

@dlebech
Copy link
Contributor

dlebech commented Dec 29, 2021

Summary

If onSubmit returns a promise, it runs silently in the background during handleSubmit in some cases.

This happens when createForm is called without validationSchema and onSubmit is an asynchronous function.

The behavior stems from a missing return here.

Steps to reproduce

Use createForm with an asynchronous onSubmit function and no validation.

Example Project

In the example project below, the
https://codesandbox.io/s/gifted-bush-vdhii?file=/App.svelte

What is the current bug behavior?

handleSubmit does not return the promise from onSubmit.

What is the expected correct behavior?

handleSubmit should return the promise from onSubmit.

Relevant logs and/or screenshots

Possible fixes

Add a return statement here.

@dlebech
Copy link
Contributor Author

dlebech commented Dec 29, 2021

A temporary work-around is to include a validationSchema which correctly returns the onSubmit promise.

@tjinauyeung
Copy link
Owner

🎉 This issue has been resolved in version 2.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants