Skip to content

Signal forms: Allow for non-async submission #67755

@ThiloAschebrock

Description

@ThiloAschebrock

Which @angular/* package(s) are relevant/related to the feature request?

forms

Description

Currently the return type for the submit action of signal forms is defined as a promise, i.e., Promise<TreeValidationResult>, in

form(signal(state), submission: { action });

or in

await submit(form, action);

However, there are valid use cases for synchronous submission if no server action is required.

Proposed solution

Widen the return type to MaybePromise<TreeValidationResult> to accommodate both asynchronous and synchronous use cases.

Optionally, one could also consider inferring the return type of submit to be synchronous if the action is synchronous.

Alternatives considered

Actions can be written to return Promise.resolve(result).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: formsgemini-triagedLabel noting that an issue has been triaged by gemini

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions