Next.js Fetch Caching Serving Stale Data
Your Next.js fetch requests cache data too aggressively, serving stale information even after cache revalidation. Updated data doesn't appear, users see outdated content.
Fetch caching issues occur when cache options aren't set correctly, revalidate tags aren't applied, or browser cache conflicts with Next.js caching.
Error Messages You Might See
Common Causes
- Using default fetch cache without explicit revalidate time
- Revalidate time set too high, keeping stale data too long
- Not using revalidateTag() for on-demand revalidation
- Browser cache conflicting with Next.js cache (Set-Cookie, Cache-Control headers)
- ISR not triggering revalidation properly on deployment
How to Fix It
Set revalidation: Control cache duration:fetch(url, { next: { revalidate: 3600 } }) caches 1 hour. Use 0 for no cache.
Use revalidateTag(): For on-demand updates:fetch(url, { next: { tags: ['posts'] } })
// In server action: revalidateTag('posts')
Disable cache for dynamic data: const data = await fetch(url, { cache: 'no-store' }) always fetches fresh.
Check headers: Ensure Cache-Control header set correctly. Vercel sets cache headers automatically, don't override.
Real developers can help you.
You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.
Get HelpFrequently Asked Questions
What's the default fetch cache behavior?
By default, Next.js caches fetch results at build time. Use revalidate option to refresh periodically.
How do I invalidate cache immediately?
Use revalidateTag() in server action after mutation: revalidateTag('posts'). Cache invalidates immediately across all pages using that tag.
Should I use cache: 'no-store'?
Only for user-specific data or real-time updates. For public data, use ISR with revalidate time for better performance.