xnimorz/use-debounce

Slight confusion between v4 `callPending` (function) and new `pending` (boolean)

Closed this issue · 8 comments

Hi there, first of all, thanks for providing support and putting so much effort into this hook. I'm using it in production code and it works like a charm, love the simplicity!

While the adoption for v5 is not as widespread, what do you think of renaming debounced.pending() to debounced.isPending()?

I was dealing with a bug where I was calling debounce.pending() instead of flush() as I was used to the old v4 names, and I had to read the documentation twice to realize to realize my mistake (it was, in the end, my mistake, fully aware of that).

I feel that some packages adopting the isBoolean() approach makes it more clear for developers. Of course, it is just a suggestion.

Again, thank you for your work!

Yuan

Hi @yuanworks !

Thank you for the feedback!

Yes, it's possible, as it will be better for understanding.
However, it would require a new major release.
I'd suggest waiting before the next major changes in the lib. And I'll release these changes with other major ones.

@xnimorz if you don't mind, can i implement it?

Feel free to send a PR :)
But I'll release it with other major changes, as it's pretty strange to update throughout the major release with only this change

Hi @xnimorz. That makes sense, for now definitely the v5 major release with the debounce object is great already.

@xnimorz could you please assign this issue to me and add hacktoberfest label?

@greyGroot
here is a PR that closes the issue. #68
However, I don't plan to merge it (as I said above) before any valuable major changes appear to cut a new release.

@xnimorz i was going to make pr today anyway. but you was faster than me. ok, maybe next time i will be faster with contribution :)

Published in use-debounce@6.0.0-beta, will be released as soon as I move all examples to a new version