-
Notifications
You must be signed in to change notification settings - Fork 324
fix(prerender): render layout-only parallel slot routes #1091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,6 +43,23 @@ export type RouteRow = { | |
| prerendered?: boolean; | ||
| }; | ||
|
|
||
| type AppRouteRenderEntry = Pick<AppRoute, "pagePath" | "routePath" | "parallelSlots">; | ||
|
|
||
| export function getAppRouteRenderEntryPath(route: AppRouteRenderEntry): string | null { | ||
| if (route.pagePath) return route.pagePath; | ||
| if (route.routePath) return null; | ||
|
|
||
| for (const slot of route.parallelSlots) { | ||
| if (slot.pagePath) return slot.pagePath; | ||
| } | ||
|
|
||
| for (const slot of route.parallelSlots) { | ||
| if (slot.defaultPath) return slot.defaultPath; | ||
| } | ||
|
|
||
| return null; | ||
| } | ||
|
|
||
| // ─── Regex-based export detection ──────────────────────────────────────────── | ||
|
|
||
| /** | ||
|
|
@@ -794,7 +811,12 @@ export function buildReportRows(options: { | |
| } | ||
|
|
||
| for (const route of options.appRoutes ?? []) { | ||
| const { type, revalidate } = classifyAppRoute(route.pagePath, route.routePath, route.isDynamic); | ||
| const renderEntryPath = getAppRouteRenderEntryPath(route); | ||
| const { type, revalidate } = classifyAppRoute( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that
|
||
| renderEntryPath, | ||
| route.routePath, | ||
| route.isDynamic, | ||
| ); | ||
| if (type === "unknown" && renderedRoutes.has(route.pattern)) { | ||
| // Speculative prerender confirmed this route is static. | ||
| rows.push({ pattern: route.pattern, type: "static", prerendered: true }); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: the iteration order over
parallelSlotsdetermines which slot's file is used for classification. If a route has multiple parallel slots with different segment configs (e.g., one slot page hasforce-dynamicand another is static), only the first one's config is read.This is fine for now — it matches the prerender's needs ("is there any renderable UI?") and the classification result is speculative anyway. But a brief code comment noting the first-wins semantics would help future readers not assume it scans all slots.