Closed ralphwest1 closed 1 year ago
Hey @ralphwest1, sorry for the delayed response. Is this the case only when using createServerQuery
, or is staleTime
not respected even on the client side, with regular createQuery
?
Hi @vishalbalaji, stale time is respected on the client if I use createQuery
. But not when I use createServerQuery
in a +page.ts
Just for reference, could you share a screenshot of the network requests for when you use it in +page.ts
and from a component or share a small reproduction on StackBlitz?
@ralphwest1, I made some changes to how the queries are pre-fetched and have just pushed up a new version. Now the prefetch should only happen if the data is not already in the queryCache
and therefore respect staleTime
. Could you test out v2.1.0
and let me know if the issue still persists?
@vishalbalaji I've tested v2.1.0 and it appears to be working great.
Alrighty then, glad to hear it. Thanks for opening the issue, closing it now.
I have the following code in a /+page.ts
Every time I navigate to the page the query is refetched and the staleTime is not used.
I understand that If I refresh the browser the queryClient is cleared out, but I was expecting the stale time to respected for client-side navigation.
Is there a setting where I can enable respecting staleTime for client-side navigation?