leptos_form icon indicating copy to clipboard operation
leptos_form copied to clipboard

Redirects from server functions

Open WIGGLES-dev opened this issue 1 year ago • 1 comments

I like the idea of your crate, one of the least fun things about making UIs is having to deal with forms and processing them.

That being said, your current implementation does not use the backing <Form /> component which is where all the nice 302 redirect handling is done. When trying out your crate I immediately ran into this.

I opened an issue in the Leptos repository (https://github.com/leptos-rs/leptos/issues/2069) to talk about more ergonomic handling of this, but an immediate solution would be to use the backing Form component from leptos_router as it allows you to delegate the redirects and handle the response and data validation.

WIGGLES-dev avatar Nov 24 '23 04:11 WIGGLES-dev

Hey thanks for the feedback!

So the generated component does use the Form component however the arguments that are forwarded to it through the derive macro are somewhat limited. You can see this here and here.

It sounds like your desired change would be to have the macro pass props to the Form component in a more agnostic way so that you can pass any valid Form prop? If so I'm up for that, and we can just rely on the actual leptos view macro to handle the prop passing rather than parsing out id, class, etc.

tlowerison avatar Nov 30 '23 18:11 tlowerison