leptos_form icon indicating copy to clipboard operation
leptos_form copied to clipboard

Vec of structs

Open 0xADD1E opened this issue 11 months ago • 0 comments

As it currently stands, I'm having difficulty making a form involving a Vec of Structs, even if those structs derive Form themselves. ie:

#[form(...)]
pub struct MyData {
    pub my_name: String,
    pub sub_struct: Vec<SubData>
}

#[derive(..., Form)]
#[form(...)]
pub struct SubData {
    pub my_number: i32
}

This fails with a type mismatch resolving the Signal type for SubData (FormField for Vec is only implemented where Signal is FormFieldSignal<T>, but for SubData it's __SubDataSignal).

  1. Am I missing any existing option that would help get around this
  2. If not, should Signal on SubData be changed to FormFieldSignal<__SubDataSignal>, or would a different approach be better?

0xADD1E avatar Mar 04 '24 16:03 0xADD1E