Context:
NextJS application with Incremental Static Regeneration.
Revalidate time: 24 hours in seconds.
Using prefetchQuery
, with staleTime
and cacheTime
set to 24 hours in milliseconds (multiplied Revalidate by 1000).
Sending dehydratedState
to the client.
Problem:
Page loads, has X information.
After 10 minutes, page loads, has X information, but on CLIENT SIDE, React Query is making a new request to the backend, then re-draws the app with Y information.
Even after setting staleTime
and cacheTime
, this is not being reflected in the dehydratedState
data.
I don’t need to refresh data in background, I want NextJS to handle this, that is why I had matched the revalidate
from NextJS and the staleTime
from React Query, but doesn’t seem to be working.
GetStaticProps