Long Tran
Long Tran5w ago

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
Long Tran
Long TranOP5w ago
Adding on to this, using queryClient.setQueryDefaults also seems to correctly set staleTime as well.
Alex / KATT 🐱
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"
Long Tran
Long TranOP5w ago
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