Skip to content

Fix issue where generateStaticParams, combined with parallel routes, can cause JS Out of Memory during build #73871

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

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion packages/next/src/build/segment-config/app/app-segments.ts
Original file line number Diff line number Diff line change
@@ -109,7 +109,19 @@ async function collectAppPageSegments(routeModule: AppPageRouteModule) {
// If this is a page segment, we know we've reached a leaf node associated with the
// page we're collecting segments for. We can add the collected segments to our final result.
if (name === PAGE_SEGMENT_KEY) {
segments.push(...currentSegments)
currentSegments.forEach((seg) => {
if (
segments.some(
(other) =>
other.name === seg.name &&
other.filePath === seg.filePath &&
other.param === seg.param
)
) {
return
}
segments.push(seg)
})
}

// Recursively process parallel routes
Loading