TanStackT
TanStack4y ago
5 replies
radical-lime

Why is refetch not being called?

I have a case when a query is made and then in a useEffect I get the user's location and use refetch to make the request again.
Depending on the user's device, getting the location may be very fast, less than 1 second, and then react query is dropping is dropping the refetch. I guess it is dropping it because not enough time passed from the first request?

How can I tell react-query: trust me. I know what I am doing and make the request regardless how much time passed. I also want stale time to be infinity.

Here is a code sandbox: https://codesandbox.io/s/cranky-dhawan-uen199?file=/src/App.js:0-669
CodeSandboxitsramiel
cranky-dhawan-uen199 by itsramiel using react, react-dom, react-query, react-scripts
cranky-dhawan-uen199 - CodeSandbox
Was this page helpful?