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
metropolitan-bronze•15mo ago
@Miketoast
cacheTime
is now gcTime
harsh-harlequinOP•15mo ago
thank you! I'm curious where this is in the docs, maybe I'm just bad at reading them
metropolitan-bronze•15mo ago
Are you looking at the docs for an older version maybe?
Happens all the time to me, when coming from a Google search.
harsh-harlequinOP•15mo 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 twoflat-fuchsia•15mo 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 v5metropolitan-bronze•15mo 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'?