Skip to content

A more official way to handle form actions with prerendering? #15158

@maksiksq

Description

@maksiksq

Describe the problem

See also:
sveltejs/svelte.dev#1728

I think form actions seem like the obvious choice in many use cases where you can't really use them if you want to preserve prerendering, e.g. newsletter pop-up or other pop-ups, single page apps. This seems like it's a limitation that's not going to change (#7586). So in those cases you should probably fall back to a +server.ts endpoint, but that would lose progressive enhancement, or point your form to an action of a different page, and use applyAction() as a workaround. I think it's a bit of a naive developer trap because both options are unexpected extra, often confusing steps.

Describe the proposed solution

I think clarifying this fact in the docs is sufficient, but if you can use an action of a different page to do the same thing and not lose prerendering, why not integrate that into form actions internally or at least in some semi-official way?

Alternatives considered

No response

Importance

would make my life easier

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions