Typescript error for queryKey
when passing Infinity
to cacheTime
#5790
Unanswered
brenocastelo
asked this question in
Q&A
Replies: 2 comments 1 reply
-
you want |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hi, this still seems to be an issue in version 5.45.1. This error seems to be resolved in version 5 by changing cacheTime to gcTime. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I'm implementing a data fetching where I want to keep the cache until the data is fetched again after being stale, so I set the
cacheTime
forInfinity
(as described by the docs). The issue is that when I setcacheTime
toInfinity
, typescript start complaining about thequeryKey
:If I set
cacheTime
with a number, there's no issue. I notice that in the type definition forcacheTime
is only a optional number, no sign ofInfinity
.I would like to know if there is any way to handle this issue and why exactly,
queryKey
complains when we set 'cacheTime' value with a not number value.Thanks inn advance.
Beta Was this translation helpful? Give feedback.
All reactions