Closed
Description
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:
- https://www.npmjs.com/package/debounce
- https://github.com/xnimorz/use-debounce?tab=readme-ov-file#advanced-usage
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.