Open
Description
Describe the problem
An unhelpful error message presents itself when we have a form with use:enhance
posting to an ordinary POST endpoint instead of a SvelteKit action. This occurs because the enhance action tries to parse the fetch response body as a JSON. If that succeeds, it looks for a data
property and attempts to parse it as JSON too, which can throw an error. If there is no data
property, submitting the form results in nothing happening, which can be confusing.
Describe the proposed solution
Maybe we can handle the outcome better or have a dev-only warning when this occurs?
Alternatives considered
Document that use:enhance
should only be used with SvelteKit actions
Importance
nice to have
Additional Information
No response