Replies: 1 comment
-
we are not calling
Data being marked as stale after staleTime does not mean the next time it is read, it will lead to an automatic fetch. This goes back to my tweet you've linked where I tried to explain that every time a component re-renders, it reads data from the cache. How else could I guess the easy answer is No, we don't provide metrics about cache effectiveness. End of story. But I'm still trying to understand what you actually want to compare. I guess you are not counting a re-render that reads data from the cache as a cache it? So what is a cache hit then? A situation where, if you wouldn't use react-query but |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem I'm trying to solve
I would like to be able to emit telemetry about QueryCache behaviour.
Specific questions that would be useful to answer:
staleTime
is actually having the intended effect of reducing calls for upstream data.What I've Tried
QueryCache
and overridinggetQueryData()
:getQueryData()
would again miss.staleTime
did not work as I would expect: despite a 60 secondstaleTime
being configured, items continued to return from cache until they were deleted after 5 minutes by a separate operation.getQueryData()
.getQueryData()
would fire more than intended?Suggested Implementation
Something like a
queryClient.subscribe
that would allow an observer to see, for each query:Beta Was this translation helpful? Give feedback.
All reactions