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:
- Returns
undefined if a form is invalid.
- 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?
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:undefinedif a form is invalid.Promise<response>after the dispatchedaction.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).