Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected behavior of use_debounce #39

Open
jgraydus opened this issue Nov 13, 2023 · 0 comments
Open

unexpected behavior of use_debounce #39

jgraydus opened this issue Nov 13, 2023 · 0 comments

Comments

@jgraydus
Copy link

It seems that use_debounce returns a callback in a triggered state. That is, after the given time elapses the original callback is invoked whether or not the debounced version was ever invoked. This is not the behavior that I would expect. Is this the desired behavior for this hook?

The following code demonstrates:

use gloo_console::log;
use yew::prelude::*;
use yew_hooks::use_debounce;

#[function_component(App)]
fn app() -> Html {
  let f = use_debounce(|| {
    log!("this should never print, but it does");
  }, 1000);

  html! {}
}

fn main() {
  yew::Renderer::<App>::new().render();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant