Skip to content
Discussion options

You must be logged in to vote

are you prefetching the query with queryClient.prefetchQuery and then use hydration? If so, I think you are just experiencing what's described here:

https://react-query.tanstack.com/guides/ssr#staleness-is-measured-from-when-the-query-was-fetched-on-the-server

Because staleTime defaults to 0, queries will be refetched in the background on page load by default. You might want to use a higher staleTime to avoid this double fetching, especially if you don't cache your markup.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@italodeandra
Comment options

@TkDodo
Comment options

@italodeandra
Comment options

Answer selected by italodeandra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants