Next.js Discord

Discord Forum

Avoid "stale while revalidate" behaviour when making requests

Unanswered
Chestnut-sided Warbler posted this in #help-forum
Open in Discord
Chestnut-sided WarblerOP
I've done a fair bit of Googling around this but can't seem to find a definitive answer. I'm using App Router in Next 14 if relevant. I believe most people will be familiar with this problem already, but the short version is:

- Have an app that makes requests to an external API, set revalidate to an hour.
- Client 1 makes the first request, fresh data is fetched since there is no cache at the moment.
- Client 2 makes another request several minutes later, they get served the cached data.
- Client 3 makes another request a month later, they get served month old data while it is revalidated.

Obviously client 3 can now refresh and will see fresh data, but this behaviour seems so flawed for so many use cases that I'm convinced there must be a clean workaround.

0 Replies