Skip to content

Input silently ignores update #71

@blset

Description

@blset

This component works on full page reload but not on navigation

But there is something with Input because if I change it by bare input, it works on navigation.

the component is a sort of autocomplete.


#[component]
fn AssocierActivite( activite_id: Option<i32>, activite: Option<String>, ccn: Option<String>) -> impl IntoView {

    use super::server::list_activites;
   // use super::models::ActiviteForEntreprise;

    let (aid, set_aid) = signal(activite_id);
    let (act, set_act) = signal(activite.unwrap_or("Aucune activité précisée".to_string()));

    let (frag, set_frag) = signal(String::new());

    let open = RwSignal::new(false);
    let suggestions = Resource::new(
        move || frag.get(),
        move |value| {
            leptos::logging::debug_log!("frag {}", value);
           async move {
               list_activites(value, None).await

        }}
    );


    view! {
        <div class="flex flex-col relative">
            <input name="activite_id" prop:value=move || aid.get().map(|v| v.to_string()) />
            <InputGroup>
                <input  <------ works with bare input but not with Input except on full page reload
                    placeholder="changer d'activité..."
                    on:input=move |ev| {
                        open.set(true);
                        web_sys::console::log_1(&"INPUT FIRED".into());
                        set_frag.set(event_target_value(&ev));
                    }
                />
                <InputGroupAddon align="block-start" class="font-bold text-indicateurs">
                    {move || act.get()}
                </InputGroupAddon>

            </InputGroup>

see also
https://discord.com/channels/1031524867910148188/1500469136898134126/1500469136898134126

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