Skip to content

applyAction should navigate to action if action is different from current route #9999

Description

@paoloricciuti

Describe the bug

If a form has an action to another route and you use enhance as per doc it doesn't automatically navigate to the new route.

But from the doc it seems like using applyAction should apply the default browser behavior.

This doesn't seem to be the case: the action gets called but the routing doesn't happen.

Reproduction

  1. Go to https://www.sveltelab.dev/j9dffhs0vu1rqub
  2. Try to submit the form
  3. Observe that the navigation doesn't happen
  4. Try to remove the use:enhance
  5. Submit the form
  6. Observe that the browser correctly redirect there

Logs

No response

System Info

System:  OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880 H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries:  Node: 16.14.2 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 7.17.0 - /usr/local/bin/npm npmPackages:  @sveltejs/adapter-auto: "2.0.0 => 2.1. 
0 
@sveltejs/kit: "1.5.0 => 1.18.0 svelte: "3.54.0 => 3.59.1 vite: "4.1.4 => 4.3.8

Severity

serious, but I can work around it

Additional Information

To be clear this is only present when the action return a success, not when it return a redirect

Metadata

Metadata

Labels

documentationImprovements or additions to documentationformsStuff relating to forms and form actions

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions