mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #1091] [MERGED] fix(prerender): render layout-only parallel slot routes #1087
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#1087
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/1091
Author: @NathanDrake2406
Created: 5/6/2026
Status: ✅ Merged
Merged: 5/6/2026
Merged by: @james-elicx
Base:
main← Head:nathan/fix-layout-only-prerender📝 Commits (1)
7deeed9fix(prerender): render layout-only parallel slot routes📊 Changes
4 files changed (+70 additions, -7 deletions)
View changed files
📝
packages/vinext/src/build/prerender.ts(+6 -5)📝
packages/vinext/src/build/report.ts(+23 -1)📝
tests/build-report.test.ts(+16 -1)📝
tests/prerender.test.ts(+25 -0)📄 Description
What this changes
Layout-only App Router routes that render through parallel slot content now participate in prerender and static export. Routes such as
/parallel-nested/home,/parallel-nested/home/nested, and/slot-collisionare rendered instead of being silently omitted fromvinext-prerender.jsonand exported output.Why
The prerender loop used
route.pagePathas the only signal that an App Router route had renderable UI. That is too narrow for parallel routes: a segment can havelayout.tsxwith nopage.tsx, while its visible content is supplied by a parallel slot page or default module.Next.js models this differently:
normalizeAppPath()ignores@slotpath segments when deriving the request pathgetLayoutOrPageModule()can load adefaultPageas the page module for the default segmentparallel-routes-and-interception.test.tsApproach
Add a shared
getAppRouteRenderEntryPath()helper that defines the App Router render-entry contract for build-time consumers:page.tsxremains the primary render entrypagePath, then the first slotdefaultPathBoth prerender collection and build-report classification use that helper, so route reporting and static generation agree on whether a route is renderable.
Validation
vp test run tests/prerender.test.tsvp test run tests/build-report.test.tsvp test run tests/routing.test.ts -t "layout routes whose own content is parallel slot pages|nested parallel slot sub-routes from layout-only parent"vp test run tests/build-report.test.ts tests/prerender.test.ts tests/routing.test.ts -t "layout-only parallel-slot app routes|layout-only routes|layout routes whose own content is parallel slot pages|nested parallel slot sub-routes from layout-only parent"vp check packages/vinext/src/build/prerender.ts packages/vinext/src/build/report.ts tests/prerender.test.ts tests/build-report.test.tsRisks / follow-ups
This intentionally does not change route graph discovery or request-time rendering. It only fixes build-time route collection/classification for routes already discovered and renderable by the App Router runtime.
Closes #1052
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.