Skip to main content

Posts

Showing posts with the label Next.js 15

Next.js 15 Caching: Why Your Data Is Not Caching and How to Fix It

  You’ve just migrated a production application to Next.js 15. The build passes, linting is clean, and the app runs. But monitoring tools are signaling a critical anomaly: database connections have spiked, third-party API quotas are draining rapidly, and page load times (TTFB) have degraded. The behavior of your application has inverted. Static pages are rendering dynamically, and data you expected to remain fresh for hours is being refetched on every single request. This is not a bug. It is the result of a fundamental architectural shift in Next.js 15 regarding default caching strategies. The Root Cause: Standardizing  fetch  Behavior In Next.js 14, the framework extended the native Web  fetch  API to default to  cache: 'force-cache' . This meant that unless you explicitly opted out, Next.js aggressively cached every GET request in the Data Cache. While performant, this was "magic" behavior that deviated from web standards and often led to the "stale data"...