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

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.

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. Milan Surelia Milan Surelia Milan Surelia is a Mobile App Developer with 5+ years of experience crafting scalable, cross-platform apps at 7Span and Meticha. At 7Span, he engineers feature-rich Flutter apps with smooth performance and modern UI. As the Co-Founder of Meticha, he builds open-source tools and developer-focused products that solve real-world problems. Expertise: 💡 Developing cross-platform apps using Flutter, Dart, and Jetpack Compose for Android, iOS, and Web. 🖋️ Sharing insights through technical writing, blogging, and open-source contributions. 🤝 Collaborating closely with designers, PMs, and developers to build seamless mobile experiences. Notable Achievements: 🎯 Revamped the Vepaar app into Vepaar Store & CRM with a 2x performance boost and smoother UX. 🚀 Launched Compose101 — a Jetpack Compose starter kit to speed up Android development. 🌟 Open source contributions on Github & StackOverflow for Flutter & Dart 🎖️ Worked on improving app performance and user experience with smart solutions. Milan is always happy to connect, work on new ideas, and explore the latest in technology. Caio Rodrigues Caio Rodrigues I'm a full-stack developer focused on building practical and scalable web applications. My main experience is with **React, TypeScript, and modern frontend architectures**, where I prioritize clean code, component reusability, and maintainable project structures. I have strong experience working with **dynamic forms, state management (Redux / React Hook Form), and complex data-driven interfaces**. I enjoy solving real-world problems by turning ideas into reliable software that companies can actually use in their daily operations. Beyond coding, I care about **software quality and architecture**, following best practices for componentization, code organization, and performance optimization. I'm also comfortable working across the stack when needed, integrating APIs, handling business logic, and helping transform prototypes into production-ready systems. My goal is always to deliver solutions that are **simple, efficient, and genuinely useful for the people using them.** legrab legrab I'll fill this later Franck Plazanet Franck Plazanet I am a Strategic Engineering Leader with over 8 years of experience building high-availability enterprise systems and scaling high-performing technical teams. My focus is on bridging the gap between complex technology and business growth. Core Expertise: 🚀 Leadership: Managing and coaching teams of 15+ engineers, fostering a culture of accountability and continuous improvement. 🏗️ Architecture: Enterprise Core Systems, Multi-system Integration (ERP/API/ETL), and Core Database Structure. ☁️ Cloud & Scale: AWS Expert; architected systems handling 10B+ monthly requests and managing 100k+ SKUs. 📈 Business Impact: Aligning tech strategy with P&L goals to drive $70k+ in monthly recurring revenue. I thrive on "out-of-the-box" thinking to solve complex technical bottlenecks and am always looking for ways to use automation to improve business productivity. Omar Faruk Omar Faruk As a Product Engineer at Klasio, I contributed to end-to-end product development, focusing on scalability, performance, and user experience. My work spanned building and refining core features, developing dynamic website templates, integrating secure and reliable payment gateways, and optimizing the overall system architecture. I played a key role in creating a scalable and maintainable platform to support educators and learners globally. I'm enthusiastic about embracing new challenges and making meaningful contributions. Matt Butler Matt Butler Software Engineer @ AWS BurnHavoc BurnHavoc Been around fixing other peoples code for 20 years. Anthony Akpan Anthony Akpan Developer with 8 years of experience building softwares fro startups Krishna Sai Kuncha Krishna Sai Kuncha Experienced Professional Full stack Developer with 8+ years of experience across react, python, js, ts, golang and react-native. Developed inhouse websearch tooling for AI before websearch was solved : )

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