I have a very slow fetch request that gets executed in the server render process.
So my user looks on the loading screen for a long time.
I would like to cache this request, to have a faster initial load for my page.
However, it is somewhat important that my user actually gets the freshest data.
So what i would like to do is to use cached data on my server side rendering, but in there also initiate a full new fetch request.
The user then gets the cached data at first, but as soon as the fresh fetch is ready the data gets updated.
Are there any good patterns to do so?
I tried:
export const fetchUserReportsCached = unstable_cache(
fetchUserReports,
["user-reports"],
{
revalidate: 1,
},
);
but this does not automatically update the frontend after revalidation.