-
Related to #1490 Hello, I'm trying to figure out how to get progressive enhancement / graceful degradation working with an Specifically, I want the following behavior:
Everything works except for 4 when JS/WASM is disabled. The server action redirects the user back to the same route, but without the return value of the server action function, so users without JS enabled don't see the form input errors. Also, any form fields will now be empty, and there's no good way to get the original form values for the server rendered page. This means that in order to properly do progressive enhancement, for every form I would need to:
Additionally this now means that the form error state has to be encoded into the URL as a query param, which might not be desired. This is a lot of extra work to make progressive enhancement work, which seems to go against the goal of ActionForms:
Ideally, it would be great if no redirect was needed when JS/WASM is disabled. When posting a form to the current route, the server should SSR render the page with the result of the server function substituted as the server action value. Then the error messages will automatically be rendered alongside the form inputs, and there's no extra work to enable progressive enhancement. This is basically the way Remix handles route actions. Is something like this possible with Leptos? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Sure, something like this is possible with Leptos. Remix's option also works, but limits you to only one action/server function per route. There's not a built-in way to do what you're asking at the moment, but the options are either
There is not a progressively-enhanced version of 2. PRs or discussion in the linked issue welcome. |
Beta Was this translation helpful? Give feedback.
Sure, something like this is possible with Leptos. Remix's option also works, but limits you to only one action/server function per route.
There's not a built-in way to do what you're asking at the moment, but the options are either
There is not a progressively-enhanced version of 2. PRs or discussion in the linked issue welcome.