You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The oninput event fall into recursion when the listener changes its own property.
Additionally, before emitting the event, it should be checked if the value is not equal to the previous one. This prevents recursion on slower input, but the issue still appears with faster inputs.
#![allow(non_snake_case)]// import the prelude to get access to the `rsx!` macro and the `Scope` and `Element` typesuse dioxus::prelude::*;fnmain(){// launch the app in the terminal
dioxus_tui::launch(App);}// create a component that renders a div with the text "Hello, world!"pubfnApp(cx:Scope) -> Element{let name = use_state(cx, || "bob".to_string());
cx.render(rsx!{
input {// we tell the component what to render
value: "{name}",
// and what to do when the value changes
oninput: move |evt| name.set(evt.value.clone()),
}})}
Expected behavior
Should not
Screenshots
If applicable, add screenshots to help explain your problem.
Environment:
Dioxus version: 0.4.3
Rust version: 1.70.0
OS info: any
App platform: tui
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
The text was updated successfully, but these errors were encountered:
Problem
The
oninput
event fall into recursion when the listener changes its own property.Additionally, before emitting the event, it should be checked if the value is not equal to the previous one. This prevents recursion on slower input, but the issue still appears with faster inputs.
Steps To Reproduce
Steps to reproduce the behavior:
Expected behavior
Should not
Screenshots
If applicable, add screenshots to help explain your problem.
Environment:
tui
Questionnaire
The text was updated successfully, but these errors were encountered: