How ReactQuery ignores stale responses? #4909
-
// queryFn will take 1000ms+ to response
const {refetch} = useQuery('test', queryFn, {
onSuccess: () => {
console.log('111')
}
})When I call the refetch function twice in a short period time, I find the text "111" appears only once. I wondering how ReactQuery ignores stale responses. Could you show me the relevant code? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi 👋 I think Tanner has answered this in another discussion here.
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 🙂 |
Beta Was this translation helpful? Give feedback.
Hi 👋
I think Tanner has answered this in another discussion here.
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 🙂