Open marcebdev opened 1 week ago
I don't mean to be bitter or rude and can def appreciate the contributions to this library, but given such a critical/misdocumented issue with this hook and seeing other debounce hook related issues I think I'll step away from this library.
FWIW this library has one of my fav set of functions but if they don't work reliably it's hard to rely on them
Describe the bug
Debounce is called multiple times if you use a non-memoized function like an inline arrow function or something like you'd typically put into a
useCallback
(so not passing a setState` or something directly).Using a custom arrow function like you'd use
useCallback
or something similar is not uncommon nor unresonable. Many other libraries show better examples (than passing a useState directly) and use something like this as an example e.g. https://mantine.dev/hooks/use-debounced-callback/So the issues are many fold:
useState
is basically cheatingTo Reproduce
Expected behavior
debounced functions should be called once
Right now that console will print the following if "123" is typed
Additional context
No response