Skip to content
Discussion options

You must be logged in to vote

Hi 👋

I think Tanner has answered this in another discussion here.

React Query does this automatically by tracking and sharing promises via the query key. So if 3 requests to fetch the same query are made close to each other, the first will actually fire, create a promise, and the next two will use the promise created by the first. One request, one promise, three promise resolutions.

If you're interested in looking at how this is implemented internally, TanStack Query is open source; you can look at the source code on GitHub.

Hopefully this helps 🙂

Replies: 1 comment

Comment options

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