Unverified Commit 8dd8a958 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

Remove `isRoutePPREnabled` from render options and delete dead PPR branch (#90713)

Stacked on https://github.com/vercel/next.js/pull/90704

This PR replaces `experimental.isRoutePPREnabled` render options with
`cacheComponents` and removes unused code.

Verified deployment tests pass on CI:
https://github.com/vercel/next.js/actions/runs/22536405880
parent 1d14e93c
...@@ -2872,9 +2872,6 @@ export default async function build( ...@@ -2872,9 +2872,6 @@ export default async function build(
const appConfig = appDefaultConfigs.get(originalAppPath) const appConfig = appDefaultConfigs.get(originalAppPath)
const isDynamicError = appConfig?.dynamic === 'error' const isDynamicError = appConfig?.dynamic === 'error'
const isRoutePPREnabled: boolean =
!!appConfig && isAppCacheComponentsEnabled
routes.forEach((route) => { routes.forEach((route) => {
// If the route has any dynamic root segments, we need to skip // If the route has any dynamic root segments, we need to skip
// rendering the route. This is because we don't support // rendering the route. This is because we don't support
...@@ -2899,7 +2896,6 @@ export default async function build( ...@@ -2899,7 +2896,6 @@ export default async function build(
_fallbackRouteParams: route.fallbackRouteParams, _fallbackRouteParams: route.fallbackRouteParams,
_isDynamicError: isDynamicError, _isDynamicError: isDynamicError,
_isAppDir: true, _isAppDir: true,
_isRoutePPREnabled: isRoutePPREnabled,
_allowEmptyStaticShell: !route.throwOnEmptyStaticShell, _allowEmptyStaticShell: !route.throwOnEmptyStaticShell,
} }
}) })
......
...@@ -715,7 +715,6 @@ export async function handler( ...@@ -715,7 +715,6 @@ export async function handler(
: {}), : {}),
cacheComponents: Boolean(nextConfig.cacheComponents), cacheComponents: Boolean(nextConfig.cacheComponents),
experimental: { experimental: {
isRoutePPREnabled,
expireTime: nextConfig.expireTime, expireTime: nextConfig.expireTime,
staleTimes: nextConfig.experimental.staleTimes, staleTimes: nextConfig.experimental.staleTimes,
dynamicOnHover: Boolean(nextConfig.experimental.dynamicOnHover), dynamicOnHover: Boolean(nextConfig.experimental.dynamicOnHover),
......
...@@ -157,7 +157,6 @@ async function requestHandler( ...@@ -157,7 +157,6 @@ async function requestHandler(
Boolean(nextConfig.logging.serverFunctions), Boolean(nextConfig.logging.serverFunctions),
cacheComponents: Boolean(nextConfig.cacheComponents), cacheComponents: Boolean(nextConfig.cacheComponents),
experimental: { experimental: {
isRoutePPREnabled: false,
expireTime: nextConfig.expireTime, expireTime: nextConfig.expireTime,
staleTimes: nextConfig.experimental.staleTimes, staleTimes: nextConfig.experimental.staleTimes,
dynamicOnHover: Boolean(nextConfig.experimental.dynamicOnHover), dynamicOnHover: Boolean(nextConfig.experimental.dynamicOnHover),
......
...@@ -104,7 +104,7 @@ export async function exportAppPage( ...@@ -104,7 +104,7 @@ export async function exportAppPage(
} = metadata } = metadata
// Ensure we don't postpone without having PPR enabled. // Ensure we don't postpone without having PPR enabled.
if (postponed && !renderOpts.experimental.isRoutePPREnabled) { if (postponed && !renderOpts.cacheComponents) {
throw new Error('Invariant: page postponed without PPR being enabled') throw new Error('Invariant: page postponed without PPR being enabled')
} }
...@@ -144,8 +144,7 @@ export async function exportAppPage( ...@@ -144,8 +144,7 @@ export async function exportAppPage(
const hasFallbackParams = const hasFallbackParams =
fallbackRouteParams != null && fallbackRouteParams.size > 0 fallbackRouteParams != null && fallbackRouteParams.size > 0
const shouldWriteRsc = const shouldWriteRsc =
!renderOpts.experimental.isRoutePPREnabled || !renderOpts.cacheComponents || (!postponed && !hasFallbackParams)
(!postponed && !hasFallbackParams)
hasStaticRsc = shouldWriteRsc hasStaticRsc = shouldWriteRsc
// With PPR enabled, we normally skip writing .rsc because it may contain // With PPR enabled, we normally skip writing .rsc because it may contain
...@@ -197,7 +196,7 @@ export async function exportAppPage( ...@@ -197,7 +196,7 @@ export async function exportAppPage(
// When PPR is enabled, we don't always send 200 for routes that have been // When PPR is enabled, we don't always send 200 for routes that have been
// pregenerated, so we should grab the status code from the mocked // pregenerated, so we should grab the status code from the mocked
// response. // response.
let status: number | undefined = renderOpts.experimental.isRoutePPREnabled let status: number | undefined = renderOpts.cacheComponents
? res.statusCode ? res.statusCode
: undefined : undefined
......
...@@ -109,10 +109,6 @@ async function exportPageImpl( ...@@ -109,10 +109,6 @@ async function exportPageImpl(
// Check if this should error when dynamic usage is detected. // Check if this should error when dynamic usage is detected.
_isDynamicError: isDynamicError = false, _isDynamicError: isDynamicError = false,
// If this page supports partial prerendering, then we need to pass that to
// the renderOpts.
_isRoutePPREnabled: isRoutePPREnabled,
// Configure the rendering of the page to allow that an empty static shell // Configure the rendering of the page to allow that an empty static shell
// is generated while rendering using PPR and Cache Components. // is generated while rendering using PPR and Cache Components.
_allowEmptyStaticShell: allowEmptyStaticShell = false, _allowEmptyStaticShell: allowEmptyStaticShell = false,
...@@ -271,7 +267,6 @@ async function exportPageImpl( ...@@ -271,7 +267,6 @@ async function exportPageImpl(
allowEmptyStaticShell, allowEmptyStaticShell,
experimental: { experimental: {
...commonRenderOpts.experimental, ...commonRenderOpts.experimental,
isRoutePPREnabled,
}, },
renderResumeDataCache, renderResumeDataCache,
} }
......
...@@ -117,7 +117,7 @@ async function createComponentTreeInternal( ...@@ -117,7 +117,7 @@ async function createComponentTreeInternal(
isRoot: boolean isRoot: boolean
): Promise<CacheNodeSeedData> { ): Promise<CacheNodeSeedData> {
const { const {
renderOpts: { nextConfigOutput, experimental, cacheComponents }, renderOpts: { nextConfigOutput, cacheComponents },
workStore, workStore,
componentMod: { componentMod: {
createElement, createElement,
...@@ -287,7 +287,7 @@ async function createComponentTreeInternal( ...@@ -287,7 +287,7 @@ async function createComponentTreeInternal(
workStore.forceDynamic = true workStore.forceDynamic = true
// TODO: (PPR) remove this bailout once PPR is the default // TODO: (PPR) remove this bailout once PPR is the default
if (workStore.isStaticGeneration && !experimental.isRoutePPREnabled) { if (workStore.isStaticGeneration && !cacheComponents) {
// If the postpone API isn't available, we can't postpone the render and // If the postpone API isn't available, we can't postpone the render and
// therefore we can't use the dynamic API. // therefore we can't use the dynamic API.
const err = new DynamicServerError( const err = new DynamicServerError(
...@@ -347,7 +347,7 @@ async function createComponentTreeInternal( ...@@ -347,7 +347,7 @@ async function createComponentTreeInternal(
defaultRevalidate === 0 && defaultRevalidate === 0 &&
// If the postpone API isn't available, we can't postpone the render and // If the postpone API isn't available, we can't postpone the render and
// therefore we can't use the dynamic API. // therefore we can't use the dynamic API.
!experimental.isRoutePPREnabled !cacheComponents
) { ) {
const dynamicUsageDescription = `revalidate: 0 configured ${segment}` const dynamicUsageDescription = `revalidate: 0 configured ${segment}`
workStore.dynamicUsageDescription = dynamicUsageDescription workStore.dynamicUsageDescription = dynamicUsageDescription
...@@ -372,7 +372,7 @@ async function createComponentTreeInternal( ...@@ -372,7 +372,7 @@ async function createComponentTreeInternal(
// For dynamic requests, this must always be `false` because dynamic responses // For dynamic requests, this must always be `false` because dynamic responses
// are never partial. // are never partial.
const isPossiblyPartialResponse = const isPossiblyPartialResponse =
isStaticGeneration && experimental.isRoutePPREnabled === true isStaticGeneration && cacheComponents === true
const LayoutOrPage: ComponentType<any> | undefined = layoutOrPageMod const LayoutOrPage: ComponentType<any> | undefined = layoutOrPageMod
? interopDefault(layoutOrPageMod) ? interopDefault(layoutOrPageMod)
...@@ -534,7 +534,7 @@ async function createComponentTreeInternal( ...@@ -534,7 +534,7 @@ async function createComponentTreeInternal(
// possible during both prefetches and dynamic navigations. But during // possible during both prefetches and dynamic navigations. But during
// the beta period, we should be clear about this trade off in our // the beta period, we should be clear about this trade off in our
// communications. // communications.
!experimental.isRoutePPREnabled !cacheComponents
) { ) {
// Don't prefetch this child. This will trigger a lazy fetch by the // Don't prefetch this child. This will trigger a lazy fetch by the
// client router. // client router.
...@@ -740,7 +740,7 @@ async function createComponentTreeInternal( ...@@ -740,7 +740,7 @@ async function createComponentTreeInternal(
if ( if (
workStore.isStaticGeneration && workStore.isStaticGeneration &&
workStore.forceDynamic && workStore.forceDynamic &&
experimental.isRoutePPREnabled cacheComponents
) { ) {
return createSeedData( return createSeedData(
ctx, ctx,
......
...@@ -142,11 +142,6 @@ export interface RenderOptsPartial { ...@@ -142,11 +142,6 @@ export interface RenderOptsPartial {
isPrefetch?: boolean isPrefetch?: boolean
htmlLimitedBots: string | undefined htmlLimitedBots: string | undefined
experimental: { experimental: {
/**
* When true, it indicates that the current page supports partial
* prerendering.
*/
isRoutePPREnabled?: boolean
expireTime: number | undefined expireTime: number | undefined
staleTimes: ExperimentalConfig['staleTimes'] | undefined staleTimes: ExperimentalConfig['staleTimes'] | undefined
clientTraceMetadata: string[] | undefined clientTraceMetadata: string[] | undefined
......
...@@ -52,7 +52,7 @@ export async function walkTreeWithFlightRouterState({ ...@@ -52,7 +52,7 @@ export async function walkTreeWithFlightRouterState({
MetadataOutlet: React.ComponentType MetadataOutlet: React.ComponentType
}): Promise<FlightDataPath[]> { }): Promise<FlightDataPath[]> {
const { const {
renderOpts: { nextFontManifest, experimental }, renderOpts: { nextFontManifest, experimental, cacheComponents },
query, query,
isPrefetch, isPrefetch,
getDynamicParamFromSegment, getDynamicParamFromSegment,
...@@ -124,7 +124,7 @@ export async function walkTreeWithFlightRouterState({ ...@@ -124,7 +124,7 @@ export async function walkTreeWithFlightRouterState({
if ( if (
isInsideSharedLayout && isInsideSharedLayout &&
!experimental.isRoutePPREnabled && !cacheComponents &&
// If PPR is disabled, and this is a request for the route tree, then we // If PPR is disabled, and this is a request for the route tree, then we
// never render any components. Only send the router state. // never render any components. Only send the router state.
(parsedRequestHeaders.isRouteTreePrefetchRequest || (parsedRequestHeaders.isRouteTreePrefetchRequest ||
......
...@@ -29,10 +29,7 @@ export type WorkStoreContext = { ...@@ -29,10 +29,7 @@ export type WorkStoreContext = {
fetchCache?: AppSegmentConfig['fetchCache'] fetchCache?: AppSegmentConfig['fetchCache']
isPossibleServerAction?: boolean isPossibleServerAction?: boolean
pendingWaitUntil?: Promise<any> pendingWaitUntil?: Promise<any>
experimental: Pick< experimental: Pick<RenderOpts['experimental'], 'authInterrupts'>
RenderOpts['experimental'],
'isRoutePPREnabled' | 'authInterrupts'
>
/** /**
* Fetch metrics attached in patch-fetch.ts * Fetch metrics attached in patch-fetch.ts
......
...@@ -40,7 +40,6 @@ const zExportMap: zod.ZodType<ExportPathMap> = z.record( ...@@ -40,7 +40,6 @@ const zExportMap: zod.ZodType<ExportPathMap> = z.record(
_fallbackRouteParams: z.array(z.any()).optional(), _fallbackRouteParams: z.array(z.any()).optional(),
_isAppDir: z.boolean().optional(), _isAppDir: z.boolean().optional(),
_isDynamicError: z.boolean().optional(), _isDynamicError: z.boolean().optional(),
_isRoutePPREnabled: z.boolean().optional(),
_allowEmptyStaticShell: z.boolean().optional(), _allowEmptyStaticShell: z.boolean().optional(),
}) })
) )
......
...@@ -1039,11 +1039,6 @@ export type ExportPathMap = { ...@@ -1039,11 +1039,6 @@ export type ExportPathMap = {
*/ */
_isDynamicError?: boolean _isDynamicError?: boolean
/**
* @internal
*/
_isRoutePPREnabled?: boolean
/** /**
* When true, the page is prerendered as a fallback shell, while allowing * When true, the page is prerendered as a fallback shell, while allowing
* any dynamic accesses to result in an empty shell. This is the case when * any dynamic accesses to result in an empty shell. This is the case when
......
...@@ -302,7 +302,6 @@ export async function adapter( ...@@ -302,7 +302,6 @@ export async function adapter(
params.request.nextConfig?.experimental?.cacheLife, params.request.nextConfig?.experimental?.cacheLife,
cacheComponents: false, cacheComponents: false,
experimental: { experimental: {
isRoutePPREnabled: false,
authInterrupts: authInterrupts:
!!params.request.nextConfig?.experimental?.authInterrupts, !!params.request.nextConfig?.experimental?.authInterrupts,
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment