Skip to content

Commit

Permalink
Generate per-segment responses for any static page
Browse files Browse the repository at this point in the history
Originally I gated per-segment prefetch generation on the PPR flag,
because I thought the client Segment Cache would require PPR to be
enabled on the server. However, since then the strategy has evolved and
I do think we can roll out the Segment Cache independently of PPR.

Dynamic pages without PPR won't be able to take full advantage of the
Segment Cache, but if the page is fully static then there's no reason
we can't implement all the same behavior.

So during per-segment prerendering, I've changed the feature condition
to check for the `clientSegmentCache` flag instead of the PPR one.
  • Loading branch information
acdlite committed Dec 15, 2024
1 parent af1b74f commit f61f5ab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
5 changes: 1 addition & 4 deletions packages/next/src/server/app-render/app-render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3979,10 +3979,7 @@ async function collectSegmentData(
// decomposed into a separate stream per segment.

const clientReferenceManifest = renderOpts.clientReferenceManifest
if (
!clientReferenceManifest ||
renderOpts.experimental.isRoutePPREnabled !== true
) {
if (!clientReferenceManifest || !renderOpts.experimental.clientSegmentCache) {
return
}

Expand Down
1 change: 1 addition & 0 deletions packages/next/src/server/app-render/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export interface RenderOptsPartial {
expireTime: ExpireTime | undefined
clientTraceMetadata: string[] | undefined
dynamicIO: boolean
clientSegmentCache: boolean
inlineCss: boolean
authInterrupts: boolean
}
Expand Down
2 changes: 2 additions & 0 deletions packages/next/src/server/base-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,8 @@ export default abstract class Server<
expireTime: this.nextConfig.expireTime,
clientTraceMetadata: this.nextConfig.experimental.clientTraceMetadata,
dynamicIO: this.nextConfig.experimental.dynamicIO ?? false,
clientSegmentCache:
this.nextConfig.experimental.clientSegmentCache ?? false,
inlineCss: this.nextConfig.experimental.inlineCss ?? false,
authInterrupts: !!this.nextConfig.experimental.authInterrupts,
},
Expand Down

0 comments on commit f61f5ab

Please sign in to comment.