Skip to content

Check on Response being returned from form actions? #12787

@brunnerh

Description

@brunnerh

Describe the problem

I have seen multiple instances of json being used to try and return data from a form action.
This seems like a fairly easy mistake to make and the error is not all that helpful.

Cannot stringify arbitrary non-POJOs

Describe the proposed solution

Check if the object returned from a form action is an instance of Response and give a more specific error if that is the case.

Not sure about the exact wording. Was thinking about referencing that a "plain object" should be returned, but devalue can serialize some not so plain objects as well. Maybe the message could contain a very simple example as well.

Form actions need to return objects directly and cannot wrap them in a Response.
E.g. return { success: true };

Alternatives considered

-

Importance

nice to have

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions