T
TanStack3y ago
foreign-sapphire

Does prefetchQuery work with the persistQueryClient?

I'm building a chrome extension that persists serialized data to localStorage using prefetchQueryClient (amazing add-on, highly recommended, saves a ton of developer work - thank you to the authors). However, I notice that every time I open my chrome extension, it makes prefetch network requests although cache time is set to Infinity. The data is still being persisted locally, so I was wondering why the prefetch was still running requests -- if it's supposed to check if the cache exists first (which it does).
1 Reply
exotic-emerald
exotic-emerald3y ago
you'd need to pass a staleTime to prefetchQuery in order to let it know if the data it already has is fresh or not

Did you find this page helpful?