@@ -391,21 +391,30 @@ Search for Route Segment Config exports (these are DISABLED with Cache Component
391391
392392** Migration Map:**
393393- ` export const dynamic = 'force-static' ` → Add ` "use cache" ` + cacheLife
394- - ` export const dynamic = 'force-dynamic' ` → Add ` <Suspense> ` boundary
395- - ` export const revalidate = 3600 ` → Use ` cacheLife('hours' ) ` or custom profile
394+ - ` export const dynamic = 'force-dynamic' ` → Add ` <Suspense> ` boundary (or nothing - dynamic is default)
395+ - ` export const revalidate = X ` → Use matching ` cacheLife() ` profile (see table below)
396396- ` export const fetchCache = 'force-cache' ` → Add ` "use cache" `
397397- ` export const runtime = 'edge' ` → Keep (still supported)
398398- ` export const runtime = 'nodejs' ` → Remove (this is the default, no need to specify)
399399- ` export const dynamicParams = true ` → Use ` generateStaticParams ` instead
400400
401- ** When removing exports, add migration comments:**
401+ ** Revalidate → cacheLife Mapping:**
402+ | revalidate value | cacheLife equivalent |
403+ | ------------------| ---------------------|
404+ | ` 0 ` or ` false ` | Dynamic (no "use cache" needed) |
405+ | ` 60 ` | ` cacheLife('minutes') ` |
406+ | ` 3600 ` | ` cacheLife('hours') ` |
407+ | ` 86400 ` | ` cacheLife('days') ` |
408+ | ` 604800 ` | ` cacheLife('weeks') ` |
409+ | Other values | ` cacheLife({ revalidate: X }) ` |
410+
411+ ** When removing exports, add migration comments with the original value:**
402412``` typescript
403- // MIGRATED: Was 'force-static' (export const dynamic) - now using "use cache"
404- // MIGRATED: Was 'force-dynamic' (export const dynamic) - now using <Suspense>
405- // MIGRATED: Was revalidate: 3600 - now using cacheLife('hours')
413+ // MIGRATED from: export const revalidate = 60
414+ // → Add "use cache" + cacheLife('minutes') to maintain ~60s revalidation
406415```
407416
408- Document all locations now - you'll migrate them in Phase 5 .
417+ Document all locations now - you'll migrate them in Phase 3 .
409418
410419** Step 6: Verify configuration changes**
411420
@@ -456,11 +465,58 @@ Make these changes FIRST, before running any build or dev server:
456465grep -r " export const dynamic\|export const revalidate\|export const fetchCache" app/
457466```
458467
459- For each file found, remove these exports and add migration comments:
468+ For each file found, remove these exports and add migration comments with suggested cacheLife:
469+
470+ ** For ` export const revalidate = X ` :**
471+
472+ Use this mapping to suggest the appropriate cacheLife based on the original value:
473+
474+ | Original revalidate | Suggested cacheLife | Notes |
475+ | ---------------------| ---------------------| -------|
476+ | ` revalidate = 0 ` (or ` false ` ) | Dynamic (no cache) | Was already dynamic, no "use cache" needed |
477+ | ` revalidate = 1-59 ` | ` cacheLife('seconds') ` or custom | Very short cache, consider if caching helps |
478+ | ` revalidate = 60 ` | ` cacheLife('minutes') ` | revalidate: 60s |
479+ | ` revalidate = 61-3599 ` | ` cacheLife({ revalidate: X }) ` | Custom value needed |
480+ | ` revalidate = 3600 ` | ` cacheLife('hours') ` | revalidate: 3600s (1 hour) |
481+ | ` revalidate = 3601-86399 ` | ` cacheLife({ revalidate: X }) ` | Custom value needed |
482+ | ` revalidate = 86400 ` | ` cacheLife('days') ` | revalidate: 86400s (1 day) |
483+ | ` revalidate = 604800 ` | ` cacheLife('weeks') ` | revalidate: 604800s (1 week) |
484+
485+ ** Migration comment format - include the original value and suggestion:**
486+ ``` typescript
487+ // MIGRATED from: export const revalidate = 60
488+ // → Add "use cache" + cacheLife('minutes') to maintain ~60s revalidation
489+ import { cacheLife } from ' next/cache'
490+
491+ export default async function Page() {
492+ " use cache"
493+ cacheLife (' minutes' ) // Replaces: export const revalidate = 60
494+ // ...
495+ }
496+ ```
497+
498+ ** For custom revalidate values (not matching a preset):**
499+ ``` typescript
500+ // MIGRATED from: export const revalidate = 1800 (30 minutes)
501+ // → Add "use cache" + cacheLife({ revalidate: 1800 }) to maintain existing behavior
502+ import { cacheLife } from ' next/cache'
503+
504+ export default async function Page() {
505+ " use cache"
506+ cacheLife ({ revalidate: 1800 }) // Replaces: export const revalidate = 1800
507+ // ...
508+ }
509+ ```
510+
511+ ** For ` export const dynamic ` :**
512+ ``` typescript
513+ // MIGRATED from: export const dynamic = 'force-static'
514+ // → Add "use cache" to opt into caching (dynamic is now the default)
515+ ```
516+
460517``` typescript
461- // MIGRATED: Removed export const dynamic = 'force-static' (incompatible with Cache Components)
462- // MIGRATED: Removed export const revalidate = 3600 (incompatible with Cache Components)
463- // TODO: Will add "use cache" + cacheLife() after analyzing build errors
518+ // MIGRATED from: export const dynamic = 'force-dynamic'
519+ // → No change needed (dynamic is now the default), or wrap in <Suspense> for loading states
464520```
465521
466522** Keep these exports if found:**
@@ -1127,8 +1183,10 @@ Report findings in this format:
11271183
11281184### Step 1: Obvious Breaking Changes Removed
11291185[x] Route Segment Config exports removed: [count]
1130- - [file path]: Removed export const dynamic = 'force-static'
1131- - [file path]: Removed export const revalidate = 3600
1186+ - [file path]: Removed `export const dynamic = 'force-static'` → Added "use cache"
1187+ - [file path]: Removed `export const revalidate = 3600` → Added cacheLife('hours')
1188+ - [file path]: Removed `export const revalidate = 60` → Added cacheLife('minutes')
1189+ - [file path]: Removed `export const revalidate = 1800` → Added cacheLife({ revalidate: 1800 })
11321190 - ...
11331191
11341192[x] unstable_noStore() calls removed: [count]
@@ -1220,6 +1278,12 @@ Report findings in this format:
12201278
12211279### Summary of All Code Changes:
12221280- Total Route Segment Config exports removed: [count]
1281+ - `revalidate` exports migrated to cacheLife: [count]
1282+ - cacheLife('minutes'): [count] (was revalidate ≈ 60)
1283+ - cacheLife('hours'): [count] (was revalidate ≈ 3600)
1284+ - cacheLife('days'): [count] (was revalidate ≈ 86400)
1285+ - cacheLife({ revalidate: X }): [count] (custom values)
1286+ - `dynamic` exports removed: [count]
12231287- Total unstable_noStore() calls removed: [count]
12241288- Total Suspense boundaries added: [count]
12251289- Total "use cache" directives added: [count]
0 commit comments