Cache Components migration
What you need to know
Migrating to Cache Components means translating the intent of the old configuration, not copying its option names. Preserve what must be fresh, what may be reused and what may appear in a shell.
By the end, you can: map previous segment config intent; test cold and warm behavior.
Translate old intent into new boundaries
Old intent: dynamic = force-dynamic -> uncached request data in a runtime childOld intent: revalidate = 900 -> public cached function with reviewed lifetimeOld intent: fetchCache = force-no-store -> review each read and keep sensitive reads uncachedExpected behavior: These are migration decisions, not literal equivalences. The rest of the route may now be eligible for a shell.
How it works
Inventory each route before switching. A previously dynamic page may have a public header that can be prerendered and a runtime child that reads fresh inventory. A route with a revalidate number may contain multiple data sources with different lifetimes; replace the blanket setting with deliberately scoped caching. A route that relied on fetchCache to force a policy needs each source reviewed. Move uncached work into a Suspense boundary; add a cache directive and cacheLife only for eligible reusable work. Do not copy experimental PPR or dynamicIO settings from older tutorials. Keep the previous config and baseline behavior in version control. Cold builds, first visits, repeated visits, mutations, browser navigation and requests with different preferences are distinct checks. A build may run data reads, so use deterministic public fixtures and no production services.
Use a dedicated cached public function
import { cacheLife } from 'next/cache';export async function featuredTitles() { 'use cache'; cacheLife({ stale: 60, revalidate: 900, expire: 3600 }); return ['Fern Atlas', 'River Walk'];}Expected behavior: The static fixture returns two public titles. The lifetime applies to this cached result, not every request to the entire application.
Common mistake
Do not declare success when the migrated route compiles. Verify whether private output stays isolated and whether the freshness requirement survives both warm reads and mutations. Old and new configuration controls are not interchangeable.
Practice and verification
Prepare a migration table for /catalog and /account: old options, public and runtime regions, lifetime requirements, negative tests, rollout and rollback. Use the supplied staged verification scenarios.
Scope: App Router, proposed Next.js 16.x and React 19, Cache Components enabled in a separate fixture. Framework snippets are staged and not executed; local pure models are not framework evidence. Exact patched dependencies and platform contracts are pending.