v0 api

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

Stale data being served Cache not invalidating [next] Revalidation failed Data not updating after fetch
Stale data being servedCache not invalidating[next] Revalidation failedData not updating after fetch

Common Causes

  1. Using default fetch cache without explicit revalidate time
  2. Revalidate time set too high, keeping stale data too long
  3. Not using revalidateTag() for on-demand revalidation
  4. Browser cache conflicting with Next.js cache (Set-Cookie, Cache-Control headers)
  5. 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.

Matt Butler Matt Butler Software Engineer @ AWS Richard McSorley Richard McSorley Full-Stack Software Engineer with 8+ years building high-performance applications for enterprise clients. Shipped production systems at Walmart (4,000+ stores), Cigna (20M+ users), and Arkansas Blue Cross. 5 patents in retail/supply chain tech. Currently focused on AI integrations, automation tools, and TypeScript-first architectures. Victor Denisov Victor Denisov Developer Dor Yaloz Dor Yaloz SW engineer with 6+ years of experience, I worked with React/Node/Python did projects with React+Capacitor.js for ios Supabase expert Tejas Chokhawala Tejas Chokhawala Full-stack engineer with 5 years experience building production web apps using React, Next.js and TypeScript. Focused on performance, clean architecture and shipping fast. Experienced with Supabase/Postgres backends, Stripe billing, and building AI-assisted developer tools. Basel Issmail Basel Issmail ’m a Senior Full-Stack Developer and Tech Lead with experience designing and building scalable web platforms. I work across the full development lifecycle, from translating business requirements into technical architecture to delivering reliable production systems. My work focuses on modern web technologies, including TypeScript, Angular, Node.js, and cloud-based architectures. I enjoy solving complex technical problems and helping teams turn product ideas and prototypes into working platforms that can grow and scale. In addition to development, I often collaborate closely with product managers, business analysts, designers, and QA teams to ensure that solutions align with both technical and business goals. I enjoy working with startups and product teams where I can contribute both as a hands-on engineer and as a technical partner in designing and delivering impactful software. BurnHavoc BurnHavoc Been around fixing other peoples code for 20 years. Nam Tran Nam Tran 10 years as fullstack developer Matthew Jordan Matthew Jordan I've been working at a large software company named Kainos for 2 years, and mainly specialise in Platform Engineering. I regularly enjoy working on software products outside of work, and I'm a huge fan of game development using Unity. I personally enjoy Python & C# in my spare time, but I also specialise in multiple different platform-related technologies from my day job. Costea Adrian Costea Adrian Embedded Engineer specilizing in perception systems. Latest project was a adas camera calibration system.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently 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.

Related v0 Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help