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

use_debounce should also support async fns #66

Open
miguelpduarte opened this issue Nov 25, 2024 · 0 comments
Open

use_debounce should also support async fns #66

miguelpduarte opened this issue Nov 25, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@miguelpduarte
Copy link

A common use-case of debouncing operations is to reduce the number of search requests emitted by a front-end application to an API. Example: Only send a search request with the input text as a query when the user does not type for 200ms.

Given that currently use_debounce cannot take in an async fn as a parameter, users have to spawn a task to fetch the desired data.

I believe that it could make sense to support this case, to more ergonomically support users' use-cases which often require async to e.g. make API requests. This could potentially also enable cancelling futures that have not yet resolved when the callback should fire once more, dismissing stale data.

@DogeDark DogeDark added the enhancement New feature or request label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants