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

Improve "form.submit()" return #356

Open
kettanaito opened this issue Dec 12, 2018 · 0 comments
Open

Improve "form.submit()" return #356

kettanaito opened this issue Dec 12, 2018 · 0 comments
Labels
enhancement Enhances existing functionality. good first issue Good for newcomers.
Milestone

Comments

@kettanaito
Copy link
Owner

kettanaito commented Dec 12, 2018

What

I suggest to make the return statement of form.submit() unified for all its branching.

Why

Current behavior

Now calling form.submit() returns two different things based on the validity of a form:

  1. Returns undefined if a form is invalid.
  2. Returns Promise<response> after the dispatched action.

Expected behavior

Calling form.submit() always returns a Promise, which executes its .catch() chain if a form is invalid or its action Promise rejects, and returns the async action in the .then() call if its valid (as it does now).

Watch out for the call signature of those scenarios. When a form is invalid, it may expose a different set of argument to the .catch() hook, then if the async action rejects. Can this be unified as well?

@kettanaito kettanaito added the enhancement Enhances existing functionality. label Dec 12, 2018
@kettanaito kettanaito added this to the 1.x milestone Dec 12, 2018
@kettanaito kettanaito added the good first issue Good for newcomers. label Jan 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhances existing functionality. good first issue Good for newcomers.
Projects
None yet
Development

No branches or pull requests

1 participant