You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! First of all, thank you for this beautiful library:)
About the problem Data in my application updates quite often and it is important to provide fresh data That is why i need to have staleTime = 0 But i have SSR in the application, and to prevent refetching immediately on the CSR, the documentation recommends to increase staleTime
So i have to either increase staleTime to avoid refetching immediately but that could worsen UX, or keep staleTime equals to zero, but there will be extra requests
I tried to fix it by setting staleTime=10*1000 on initializing QueryClient and then in useEffect (so after rehydration) changing it to zero (by queryClient.setDefaultOptions). But changed staleTime is applying only to new queries. The ones that was called during rehydration continue to work with staleTime=10*1000.
It's seems to me like there should be different solution to the immediate refetch on CSR, than changing the staleTime.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
First of all, thank you for this beautiful library:)
About the problem
Data in my application updates quite often and it is important to provide fresh data
That is why i need to have
staleTime = 0But i have SSR in the application, and to prevent refetching immediately on the CSR, the documentation recommends to increase staleTime
So i have to either increase staleTime to avoid refetching immediately but that could worsen UX, or keep staleTime equals to zero, but there will be extra requests
I tried to fix it by setting
staleTime=10*1000on initializing QueryClient and then inuseEffect(so after rehydration) changing it to zero (by queryClient.setDefaultOptions).But changed staleTime is applying only to new queries. The ones that was called during rehydration continue to work with
staleTime=10*1000.It's seems to me like there should be different solution to the immediate refetch on CSR, than changing the staleTime.
Beta Was this translation helpful? Give feedback.
All reactions