Skip to content

Pass through prerender classification metadata to prerender-config.json#78

Closed
agadzik wants to merge 1 commit into
nextjs:mainfrom
agadzik:t3code/add-ppr-metadata-prerender
Closed

Pass through prerender classification metadata to prerender-config.json#78
agadzik wants to merge 1 commit into
nextjs:mainfrom
agadzik:t3code/add-ppr-metadata-prerender

Conversation

@agadzik

@agadzik agadzik commented Jul 7, 2026

Copy link
Copy Markdown

What

Forwards four per-route classification fields from AdapterOutput['PRERENDER'] into the Build Output API prerender-config.json:

  • hasPostponed — whether the build-time PPR prerender postponed
  • hasFallback — whether a dynamic route template has a static fallback shell
  • htmlSize — byte size of the prerendered HTML shell (0 = fully postponed empty shell)
  • isDynamicRoute — dynamic route template vs. concrete prerendered path

Why

Vercel's deployment summary classifies PPR and Cache Components routes from these signals. The legacy @vercel/next builder emits them (vercel/vercel#16554, vercel/vercel#16584); this adapter did not, so newer Next versions regressed the summary.

How

Pure pass-through — all four values are computed in Next core by vercel/next.js#95534 and written raw: they are tri-state, so false/0 must be preserved and only undefined keys dropped by JSON.stringify. Deliberately not using the || undefined idiom used elsewhere in this file, which would collapse false to undefined.

Since no published next canary includes vercel/next.js#95534 yet, the fields are typed via a local PrerenderClassificationFields type intersected at the read site. Remove it once the next devDependency is bumped past that PR's merge. Until then (and on older Next versions at runtime) the fields simply read undefined and are omitted — this PR is safe to merge independently.

Tests

Adds the repo's first vitest setup (vitest run, wired into the Lint workflow) with a pass-through test for handlePrerenderOutputs: asserts hasFallback: false and htmlSize: 0 survive un-mangled, and that absent fields produce no keys.

Rollout

A release of this package does nothing in production until @vercel/next bumps its pinned version and re-bundles. After merge, cut a new beta from the version-packages PR so that follow-up can pin it.

Known fast-follow (separate PR, different mechanism): .vc-config.json reports operationType: PAGE where the legacy builder emits ISR (e.g. pages/index.js with getStaticProps + revalidate), which corrupts the same deployment-summary classification these fields feed.

🤖 Generated with Claude Code

Forward hasPostponed, hasFallback, htmlSize, and isDynamicRoute from
AdapterOutput['PRERENDER'] (added in vercel/next.js#95534) so deployment
summaries can classify PPR and Cache Components routes, matching the
@vercel/next builder. The values are tri-state, so they are written raw:
false/0 are preserved and only undefined keys are dropped.

Adds the repo's first vitest setup with a pass-through test, wired into
the Lint workflow.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e86b9d3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@next-community/adapter-vercel Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

@agadzik is attempting to deploy a commit to the vtest314-next-adapter-e2e-tests Team on Vercel.

A member of the Team first needs to authorize it.

@agadzik

agadzik commented Jul 7, 2026

Copy link
Copy Markdown
Author

Superseded by #80 (same commit, branch renamed to gadzik/add-ppr-metadata-prerender).

@agadzik agadzik closed this Jul 7, 2026
@agadzik
agadzik deleted the t3code/add-ppr-metadata-prerender branch July 7, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant