useQuery() integration is not passing `staleTime` to underlying query? (11.0.0-rc.593)
I'm attempting to set up persistence for my queries. As part of this, I need to set
staleTime
on queries to something other than 0 to tell React Query that data loaded from storage is to be considered fresh. However, this doesn't work in practice if staleTime
is configured at the query level. I've managed to get persistence working correctly when configuring the query client's default options.
Is there an interaction that I'm not understanding here? Any advice would be welcome, thanks!3 Replies
Adding on to this, using
queryClient.setQueryDefaults
also seems to correctly set staleTime
as well.Open an issue 🙏 I'm surprised if this is a though - maybe you have a parallel query to the same proc without staleTime? If so, I'm not sure which option "wins"
I've wrapped the query in a custom hook so all instances get the same query options - don't think that would be the issue here. Will post more details on GH once I've narrowed this down some more