[refactor] Remove obsolete RDC and PPR feature guards

PR #84870 made RDC for Navigations part of Cache Components. PR #96827
made Cache Components the internal PPR signal, so `isRoutePPREnabled`
already implies `cacheComponents`.

This removes the redundant `supportsRDCForNavigations` check and the
fallback branch for PPR without Cache Components. The existing guards
now use `isRoutePPREnabled` directly, and their comments describe the
current behavior.
parent 299c2f48
...@@ -627,10 +627,6 @@ export function createAppPageEntrypoint({ ...@@ -627,10 +627,6 @@ export function createAppPageEntrypoint({
!shouldForceDynamicPPRRender !shouldForceDynamicPPRRender
) )
// When a page supports cacheComponents, we can support RDC for Navigations
const supportsRDCForNavigations =
isRoutePPREnabled && nextConfig.cacheComponents === true
// In development, we always want to generate dynamic HTML. // In development, we always want to generate dynamic HTML.
const supportsDynamicResponse: boolean = const supportsDynamicResponse: boolean =
// If we're in development, we always support dynamic HTML, unless it's // If we're in development, we always support dynamic HTML, unless it's
...@@ -647,7 +643,7 @@ export function createAppPageEntrypoint({ ...@@ -647,7 +643,7 @@ export function createAppPageEntrypoint({
// If this handler supports onCacheEntryV2, then we can only support // If this handler supports onCacheEntryV2, then we can only support
// dynamic responses if it's a dynamic RSC request and not in minimal mode. If it // dynamic responses if it's a dynamic RSC request and not in minimal mode. If it
// doesn't support it we must fallback to the default behavior. // doesn't support it we must fallback to the default behavior.
(supportsRDCForNavigations && getRequestMeta(req, 'onCacheEntryV2') (isRoutePPREnabled && getRequestMeta(req, 'onCacheEntryV2')
? // In minimal mode, we'll always want to generate a static response ? // In minimal mode, we'll always want to generate a static response
// which will generate the RDC for the route. When resuming a Dynamic // which will generate the RDC for the route. When resuming a Dynamic
// RSC request, we'll pass the minimal postponed data to the render // RSC request, we'll pass the minimal postponed data to the render
...@@ -1319,17 +1315,10 @@ export function createAppPageEntrypoint({ ...@@ -1319,17 +1315,10 @@ export function createAppPageEntrypoint({
pageIsDynamic && pageIsDynamic &&
(isProduction || !isPrerendered) (isProduction || !isPrerendered)
) { ) {
// When cacheComponents is enabled, we can use the fallback // Serve the fallback for document and static RSC requests. Dynamic
// response if the request is not a dynamic RSC request because the // RSC requests render separately and can reuse the RDC from cached
// RSC data when this feature flag is enabled does not contain any // postponed state.
// param references. Without this feature flag enabled, the RSC data if (isRoutePPREnabled && !isDynamicRSCRequest) {
// contains param references, and therefore we can't use the fallback.
if (
isRoutePPREnabled &&
(nextConfig.cacheComponents
? !isDynamicRSCRequest
: !isRSCRequest)
) {
const cacheKey = const cacheKey =
isProduction && typeof prerenderInfo?.fallback === 'string' isProduction && typeof prerenderInfo?.fallback === 'string'
? prerenderInfo.fallback ? prerenderInfo.fallback
...@@ -1496,11 +1485,11 @@ export function createAppPageEntrypoint({ ...@@ -1496,11 +1485,11 @@ export function createAppPageEntrypoint({
let hasFullyStaticCacheEntry = false let hasFullyStaticCacheEntry = false
if ( if (
// Dynamic RSC and Server Action requests reuse the static render's // Dynamic RSC and Server Action requests reuse the RDC from cached
// postponed state when RDC for Navigations is enabled. Its RDC // postponed state to keep cached values consistent with the
// keeps cache values consistent with the static render. Draft mode // prerender. Draft mode requests render fresh values without this
// requests must generate fresh values without this published RDC. // published RDC.
supportsRDCForNavigations && isRoutePPREnabled &&
!isDraftMode && !isDraftMode &&
process.env.NEXT_RUNTIME !== 'edge' && process.env.NEXT_RUNTIME !== 'edge' &&
!isMinimalMode && !isMinimalMode &&
...@@ -1758,9 +1747,9 @@ export function createAppPageEntrypoint({ ...@@ -1758,9 +1747,9 @@ export function createAppPageEntrypoint({
} }
const invokeOnCacheEntry = (cacheEntry: ResponseCacheEntry) => { const invokeOnCacheEntry = (cacheEntry: ResponseCacheEntry) => {
// If we support RDC for Navigations, prefer the callback that can // Prefer onCacheEntryV2 for PPR entries so the callback can receive
// deliver postponed state for both document and RSC requests. // postponed state for both document and RSC requests.
const onCacheEntry = supportsRDCForNavigations const onCacheEntry = isRoutePPREnabled
? (getRequestMeta(req, 'onCacheEntryV2') ?? ? (getRequestMeta(req, 'onCacheEntryV2') ??
getRequestMeta(req, 'onCacheEntry')) getRequestMeta(req, 'onCacheEntry'))
: getRequestMeta(req, 'onCacheEntry') : getRequestMeta(req, 'onCacheEntry')
......
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