Setting staleTime when passing in initialData server side works but prevents refetching when variables change #6161
-
Using version I'm using This is how my query is setup:
When I change the value of I'm wondering if |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
this is the expected behaviour when combining There are a couple of things you could do, depending on your use-case:
|
Beta Was this translation helpful? Give feedback.
if you change the searchText, and its part of the queryKey, you don't get a "refetch". You get a new cache entry and a new initial fetch for that Query. Except that you also pass intitialData for that query again, which like I said in option 1, you shouldn't do if you don't want that.
Maybe this explains it better:
if I don't make the extra comparison, I provide initialData to all cache entries, even if the variable isn't the initial value anymore ...