yew icon indicating copy to clipboard operation
yew copied to clipboard

Checkbox will lose the `checked` value after the component get updated.

Open ken2812221 opened this issue 3 years ago • 0 comments

Problem Checkbox will lose the checked value after the component get updated.

Steps To Reproduce Here is my test code: Update the component by setting the state.

#[function_component(App)]
pub fn app() -> Html {
    let count = use_state(|| 0);
    html! {
        <>
            <button onclick={move|_|count.set(*count)}>{"Update"}</button>
            <input type="text" />
            <input type="checkbox" />
        </>
    }
}

Playground: https://play.yew.rs/?shared=7bP0L9R1kDIHCebBwK7R

Expected behavior When I click the button, the value in text input and the checkbox should remain the same. However, the checkbox will be unchecked after I click the button.

Screenshots Before I clicked the button image After I clicked the button image

Environment:

  • Yew version: 0.19.3
  • Rust version: 1.63.0

Questionnaire

  • [ ] I'm interested in fixing this myself but don't know where to start
  • [ ] I would like to fix and I have a solution
  • [ ] I don't have time to fix this right now, but maybe later

ken2812221 avatar Sep 15 '22 15:09 ken2812221