Query set default cacheTime
Hello, I'm trying to set the staleTime and cacheTime to infinity in the queryClient default options but the typescript is giving me a warning that I can't set the cacheTime within defualtoptions -> queries (staleTime can be set there fine). Am I missing something?
thanks!
6 Replies
funny-blue•2y ago
@Miketoast
cacheTime is now gcTimeextended-salmonOP•2y ago
thank you! I'm curious where this is in the docs, maybe I'm just bad at reading them
funny-blue•2y ago
Are you looking at the docs for an older version maybe?
Happens all the time to me, when coming from a Google search.
extended-salmonOP•2y ago
here's something strange,
gcTime: Infinity works fine in the QueryClient default options but UseQueryOptions accepts
seems like there's still a mix of the twoxenial-black•2y ago
gcTime is v5, cacheTime is everything below that. Maybe you have multiple versions in your node_modules, maybe you import one from @tanstack/react-query and one from react-query (which is v3). Hard to say but there definitely is no cacheTime anywhere in v5funny-blue•2y ago
The web site is clearly showing that you are reading old documentation, but sometimes one misses it.
When coming from Google, very often I am directed to v4 (and sometimes v3).
Maybe the site can check 'if coming from Google, show version last'?