Is there any way to combine stale-while-revalidate with on-demand revalidation? #65612
Replies: 2 comments 2 replies
-
We have the same issue and would very much want a solution (stale-if-error as well, in case CMS somehow fails or timeouts). There is no workaround for keeping the latest stale version AFAIK. Nor can you preventing rendering the page again. At least there is a workaround to access "some working and cached data" and prevent users from seeing errors or wait too long, but it's hacky, limited and a lot of work:
But this "solution" is indeed hackish and limited (doesn't even give the last version, but the one at build). We'd also really like to have an actual stale-while-revalidate solution that works with revalidateTag(). |
Beta Was this translation helpful? Give feedback.
-
Hi all, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
As clearly stated in the docs, calling
revalidateTag()
immediately purges the cache instead of just marking the entries as stale.Unfortunately this does not match my use-case which I think is be pretty common:
I have ISR pages that should be cached indefinitely until a webhook gets called by the CMS. Visitors should not have to wait for the fresh content to get rendered but see a stale version while the page is updated in the background.
Is there any way to keep the STALE version around (like with time-based revalidation) when triggering a revalidation via the API?
Beta Was this translation helpful? Give feedback.
All reactions