Skip to content

Improve "form.submit()" return #356

@kettanaito

Description

@kettanaito

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions