Deprecate useDebounce in favor of the version in @wordpress/compose
Opened this issue · 4 comments
kevinfodness commented
User Story
As a package maintainer, I want to use the debounce functionality provided by WordPress rather than relying on a third party library.
Acceptance Criteria
- Deprecate the custom
useDebounce
hook in Block Editor Tools (print a console warning when it is called the first time) and instruct users to migrate touseDebounce
from@wordpress/compose
instead. - Update documentation to indicate that this hook has been deprecated and indicate that it will be removed in a future version.
renatonascalves commented
The block editor also comes with a useDebounce
: https://github.com/WordPress/gutenberg/blob/0a0bc062acd3e3dc21e6c32e8327e0016bc3a3ff/packages/compose/src/hooks/use-debounce/index.js#L31
renatonascalves commented
One can use as such:
import { useDebounce } from '@wordpress/compose';
kevinfodness commented
Fantastic, that's even better. I'll update the issue to reflect that.
renatonascalves commented
Just a note that, the way the hook from WordPress works is different from the version here and from @uidotdev
. So it is not a 1:1 replacement.