Skip to content

Proposal: Add Debouncing to useQuery Hook Using the take Option #8423

Answered by TkDodo
Amr2 asked this question in Ideas
Discussion options

You must be logged in to vote

Thanks for the detailed proposal - it warrants a detailed answer.

We’ve stated in the past that debouncing is one feature that will not make it into the Query API. I’ve talked about that in my recent talk at the React Advanced Conference “React Query API Design - Lessons Learned”:

The reason is manifold:

  1. It adds complexity to the API

lodash.debounce has a lot of options - leading, trailing, maxWait, which I think is what users would expect us to support, too. Some users might want to have throttling instead - another option we’d need to support. All of this adds to bundle size as well - lodash.debounce is 1.14kb, which is roughly a 10% increase of our current size.

  1. I…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Amr2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants