#Fetch Time-based Revalidation, but don't return if stale?

1 messages · Page 1 of 1 (latest)

topaz sigil
#

I know that using fetch('https://...', { next: { revalidate: 3600 } }) will cache the fetched data for 1 hour. But the first request after an hour, will trigger a new fetch request, but still get 1 hour old data.

Without using On-demand Revalidation, is it possible to just not return stale data after the elapsed time has passed?

So the request after 1 hour, may take longer - but it never returns 1 hour old data, after the hour.

fresh vaultBOT
#

Hi @topaz sigil. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Hmm, I don't know enough to give you a confident answer yet.

The extracts provided discuss the behavior of time-based revalidation and on-demand revalidation in Next.js, but they do not explicitly cover the scenario where stale data is never returned after the revalidation period has elapsed without using on-demand revalidation.

For more detailed information on caching strategies and how to handle stale data in Next.js, you may want to review the Next.js Documentation on Data Fetching, Caching, and Revalidating (https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: