Unverified Commit 9aefe525 authored by Zack Tanner's avatar Zack Tanner Committed by GitHub

fix PPR build output logs (#58149)

Fixes two build output logs:

- A page that uses `generateStaticParams` & postpones should be marked as partially prerendered
- Assume pages that contain dynamic segments will postpone when PPR is enabled even though it won't be determined until request time
parent d3756fac
...@@ -2301,6 +2301,13 @@ export default async function build( ...@@ -2301,6 +2301,13 @@ export default async function build(
hasEmptyPrelude, hasEmptyPrelude,
}) })
// update the page (eg /blog/[slug]) to also have the postpone metadata
pageInfos.set(page, {
...(pageInfos.get(page) as PageInfo),
hasPostponed,
hasEmptyPrelude,
})
if (revalidate !== 0) { if (revalidate !== 0) {
const normalizedRoute = normalizePagePath(route) const normalizedRoute = normalizePagePath(route)
...@@ -2386,6 +2393,9 @@ export default async function build( ...@@ -2386,6 +2393,9 @@ export default async function build(
pageInfos.set(page, { pageInfos.set(page, {
...(pageInfos.get(page) as PageInfo), ...(pageInfos.get(page) as PageInfo),
isDynamicAppRoute: true, isDynamicAppRoute: true,
// if PPR is turned on and the route contains a dynamic segment,
// we assume it'll be partially prerendered
hasPostponed: experimentalPPR,
}) })
// TODO: create a separate manifest to allow enforcing // TODO: create a separate manifest to allow enforcing
......
...@@ -459,8 +459,13 @@ export async function printTreeView( ...@@ -459,8 +459,13 @@ export async function printTreeView(
} else if (isEdgeRuntime(pageInfo?.runtime)) { } else if (isEdgeRuntime(pageInfo?.runtime)) {
symbol = 'ℇ' symbol = 'ℇ'
} else if (pageInfo?.isPPR) { } else if (pageInfo?.isPPR) {
// If the page has an empty prelude, then it's equivalent to a static page. if (
if (pageInfo?.hasEmptyPrelude || pageInfo.isDynamicAppRoute) { // If the page has an empty prelude, then it's equivalent to a dynamic page
pageInfo?.hasEmptyPrelude ||
// ensure we don't mark dynamic paths that postponed as being dynamic
// since in this case we're able to partially prerender it
(pageInfo.isDynamicAppRoute && !pageInfo.hasPostponed)
) {
symbol = 'λ' symbol = 'λ'
} else if (!pageInfo?.hasPostponed) { } else if (!pageInfo?.hasPostponed) {
symbol = '○' symbol = '○'
......
...@@ -6,7 +6,17 @@ createNextDescribe( ...@@ -6,7 +6,17 @@ createNextDescribe(
files: __dirname, files: __dirname,
skipDeployment: true, skipDeployment: true,
}, },
({ next, isNextDev }) => { ({ next, isNextDev, isNextStart }) => {
if (isNextStart) {
describe('build output', () => {
it('correctly marks pages as being partially prerendered in the build output', () => {
expect(next.cliOutput).toContain('◐ /loading/nested/[slug]')
expect(next.cliOutput).toContain('◐ /suspense/node')
expect(next.cliOutput).toContain('◐ /suspense/node/gsp/[slug]')
expect(next.cliOutput).toContain('◐ /suspense/node/nested/[slug]')
})
})
}
describe.each([ describe.each([
{ pathname: '/suspense/node' }, { pathname: '/suspense/node' },
{ pathname: '/suspense/node/nested/1' }, { pathname: '/suspense/node/nested/1' },
......
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