Skip to content

checkboxgroup lags 5s to display checked options #58

@blset

Description

@blset

here is the setup
the checkbox group displays instantly but get checked as per checked_ids only after 3 to 5 seconds


// the id arrive as i32
    let tagids  = tags.unwrap_or_default().into_iter().map(|i| i.to_string()).collect();


let checked_ids =  RwSignal::new(tagids);

// happens in a suspense to get all possible tags from db
    let rqs = Resource::new( || (), move |_| async move { list_tags().await});
    
    view! {
           
                    <Suspense fallback=|| {
                        view! { <Spinner /> }
                    }>

                        {move || match rqs.get() {
                            None => view! {}.into_any(),
                            Some(Err(e)) => e.to_string().into_any(),
                            Some(Ok(tags)) => {
                                view! {
                                    <CheckboxGroup value=checked_ids>
                                        <legend>
                                            "Tags"
                                        </legend>
                                                {tags.iter()
                                                            .map(|t| {
                                                                let t = t.clone();

                                                                view! {
                                                                    <Checkbox
                                                                        class=if t.fixe { "text-red-900" } else { "" }
                                                                        name="tags[]"
                                                                        value=t.id.to_string()
                                                                    >
                                                                        {t.nom}
                                                                    </Checkbox>
                                                                }
                                                            })
                                                            .collect_view()
                                                    }
                                            </div>
                                         
                                        </div>
                                    </CheckboxGroup>
                                }
                                    .into_any()
                            }
                        }}
                    </Suspense>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions