@@ -20,7 +20,7 @@ All flags need: `config-shared.ts` (type) → `config-schema.ts` (zod). If the f
## Where the Flag Is Consumed
**Client/bundled code only** (e.g. `__NEXT_PPR` in client components): `define-env.ts` is sufficient. Webpack/Turbopack replaces `process.env.X` at the user's build time.
**Client/bundled code only** (e.g. `__NEXT_CACHE_COMPONENTS` in client components): `define-env.ts` is sufficient. Webpack/Turbopack replaces `process.env.X` at the user's build time.
**Pre-compiled runtime bundles** (e.g. code in `app-render.tsx`): The flag must also be set as a real `process.env` var at runtime, because `app-render.tsx` runs from pre-compiled bundles where `define-env.ts` doesn't reach. Two approaches:
"1371":"Route %s used \\`io()\\` inside \\`after()\\`. The \\`io()\\` function is not allowed in this scope. See more info here: https://nextjs.org/docs/app/api-reference/functions/after",
"1372":"Route %s used \\`io()\\` inside \\`after()\\` while rendering. The \\`io()\\` function is not allowed in this scope. See more info here: https://nextjs.org/docs/app/api-reference/functions/after",
"1373":"Route %s used \\`cookies()\\` inside \\`after()\\` while rendering. This is not supported. If you need this data inside an \\`after()\\` callback, use \\`cookies()\\` outside of the callback. See more info here: https://nextjs.org/docs/app/api-reference/functions/after",
"1374":"Expected a work store while caching an `ImageResponse` during prerendering."
"1374":"Expected a work store while caching an `ImageResponse` during prerendering.",
"1375":"Route segment config \"dynamic\" is not compatible with \\`nextConfig.cacheComponents\\`. Please remove it.",
"1376":"Invariant: Cache Components cannot be enabled in export mode"
controller.abort(newBailoutToCSRError('Render in Browser'))
...
...
@@ -601,7 +506,6 @@ export function createHangingInputAbortSignal(
returncontroller.signal
case'prerender-client':
case'validation-client':
case'prerender-ppr':
case'prerender-legacy':
case'request':
case'cache':
...
...
@@ -656,17 +560,6 @@ export function useDynamicRouteParams(expression: string) {
thrownewInvariantError(
`\`${expression}\` was called from a Server Component. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`
@@ -575,7 +575,7 @@ function assignDefaultsAndValidate(
}
}
if(result.experimental.ppr){
if((result.experimentalasany).ppr){
thrownewHardDeprecatedConfigError(
`\`experimental.ppr\` has been merged into \`cacheComponents\`. The Partial Prerendering feature is still available, but is now enabled via \`cacheComponents\`. Please update your ${configFileName} accordingly.`
)
...
...
@@ -1570,11 +1570,6 @@ function assignDefaultsAndValidate(
result.experimental.mcpServer=true
}
if(result.cacheComponents){
// TODO: remove once we've finished migrating internally to cacheComponents.
result.experimental.ppr=true
}
// "use cache" was originally implicitly enabled with the cacheComponents flag, so
// we transfer the value for cacheComponents to the explicit useCache flag to ensure
@@ -96,14 +95,6 @@ export function connection(): Promise<void> {
`${exportName} must not be used within a Client Component. Next.js should be preventing ${exportName} from being included in Client Components statically, but did not in this case.`
)
}
case'prerender-ppr':
// We use React's postpone API to interrupt rendering here to create a
// dynamic hole
returnpostponeWithTracking(
workStore.route,
'connection',
workUnitStore.dynamicTracking
)
case'prerender-legacy':
// We throw an error here to interrupt prerendering to mark the route
@@ -83,14 +82,6 @@ export function cookies(): Promise<ReadonlyRequestCookies> {
thrownewInvariantError(
`${exportName} must not be used within a Client Component. Next.js should be preventing ${exportName} from being included in Client Components statically, but did not in this case.`
)
case'prerender-ppr':
// We need track dynamic access here eagerly to keep continuity with
// how cookies has worked in PPR without cacheComponents.
returnpostponeWithTracking(
workStore.route,
callingExpression,
workUnitStore.dynamicTracking
)
case'prerender-legacy':
// We track dynamic access here so we don't need to wrap the cookies
@@ -69,7 +68,6 @@ export function draftMode(): Promise<DraftMode> {
// Otherwise, we fall through to providing an empty draft mode.
// eslint-disable-next-line no-fallthrough
case'prerender':
case'prerender-ppr':
case'prerender-legacy':
// Return empty draft mode
returncreateOrGetCachedDraftMode(null,workStore)
...
...
@@ -243,12 +241,6 @@ function trackDynamicDraftMode(expression: string, constructorOpt: Function) {
thrownewInvariantError(
`${exportName} must not be used within a Client Component. Next.js should be preventing ${exportName} from being included in Client Components statically, but did not in this case.`
@@ -82,7 +81,6 @@ export function headers(): Promise<ReadonlyHeaders> {
case'validation-client':
case'private-cache':
case'prerender-runtime':
case'prerender-ppr':
case'prerender-legacy':
case'request':
break
...
...
@@ -107,16 +105,6 @@ export function headers(): Promise<ReadonlyHeaders> {
thrownewInvariantError(
`${exportName} must not be used within a client component. Next.js should be preventing ${exportName} from being included in client components statically, but did not in this case.`
)
case'prerender-ppr':
// PPR Prerender (no cacheComponents)
// We are prerendering with PPR. We need track dynamic access here eagerly
// to keep continuity with how headers has worked in PPR without cacheComponents.
// TODO consider switching the semantic to throw on property access instead
returnpostponeWithTracking(
workStore.route,
callingExpression,
workUnitStore.dynamicTracking
)
case'prerender-legacy':
// Legacy Prerender
// We are in a legacy static generation mode while prerendering
`${expression} must not be used within a client component. Next.js should be preventing ${expression} from being included in client components statically, but did not in this case.`
@@ -16,7 +16,7 @@ export function markCurrentScopeAsDynamic(store, expression) {
}elseif(store.dynamicShouldError){
thrownewStaticGenBailoutError(`Route ${pathname} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${expression}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`);
@@ -34,7 +34,7 @@ export function trackDynamicDataAccessed(store, expression) {
}elseif(store.dynamicShouldError){
thrownewStaticGenBailoutError(`Route ${pathname} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${expression}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`);
constreason=`Route ${pathname} needs to bail out of prerendering at this point because it used ${expression}. `+`React throws this special object to indicate where. It should not be caught by `+`your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error`;