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

useDebouncedCallback should be cancelable #426

Open
niksajanjic opened this issue Jan 3, 2025 · 1 comment
Open

useDebouncedCallback should be cancelable #426

niksajanjic opened this issue Jan 3, 2025 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@niksajanjic
Copy link

This is a PRO feature, but I don't see @coreui/react-pro repository to report an issue:
import { useDebouncedCallback } from '@coreui/react-pro';

If we look at lodash debounce method, or some of the popular libs like:

You can see that they all have the ability to cancel scheduled executions. CoreUI debounce solution does not which means it is very limited in it's capabilities. Flush and pending status can be optional, but cancel is a must in my opinion.

One of the reasons is when we use CMultiSelect and we want to show the options from external source, common practice is to trigger a request after 3 characters were typed. That means we need to cancel any debounce if the user types 3 or more characters and then deletes them quickly.

@mrholek
Copy link
Member

mrholek commented Jan 3, 2025

Thank you for your feedback, @niksajanjic. I believe we can include those missing features. I'll handle it, but I need to close some tasks first.

@mrholek mrholek added the enhancement New feature or request label Jan 3, 2025
@mrholek mrholek self-assigned this Jan 3, 2025
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