Skip to content

useDebouncedCallback should be cancelable #426

Closed
@niksajanjic

Description

@niksajanjic

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions