You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix build crash with parallel routes and root-level dynamic parameters (#85074)
### What?
Fixes a build-time crash that occurs when using parallel routes (`@slot`
syntax) combined with root-level dynamic parameters (e.g., `[locale]`)
in the App Router.
### Why?
When building static paths for routes with both parallel routes and
root-level dynamic parameters, the build would crash during pathname
generation. This happened because the code was using `RouteRegex.groups`
to determine parameter properties (`repeat`/`optional`), but the regex
groups didn't properly handle segment names for nested parallel route
structures. The pathname replacement logic would fail when trying to
match segment patterns, causing the build to abort.
This is a critical issue because it blocks developers from using a
common pattern: internationalization with parallel routes (e.g.,
`/[locale]/@modal/...`).
### How?
The fix refactors the parameter validation logic to use
`DynamicParamTypes` directly instead of relying on `RouteRegex`:
1. Created a new `getParamProperties()` utility in
`get-segment-param.tsx` that determines `repeat` and `optional`
properties based on the parameter type (catchall, optional-catchall,
dynamic, etc.)
2. Updated `buildAppStaticPaths()` to use this utility instead of
`RouteRegex.groups`
3. Changed pathname replacement to use the segment name from
`childrenRouteParamSegments` rather than reconstructing it from the
regex pattern
This approach:
- Eliminates the mismatch between regex-based pattern matching and
actual segment structure
- Properly handles parallel route segment names
- Makes the code more maintainable by using the type system instead of
regex internals
Fixes#84509
Copy file name to clipboardExpand all lines: packages/next/errors.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -891,5 +891,6 @@
891
891
"890": "Received an underlying cookies object that does not match either `cookies` or `mutableCookies`",
892
892
"891": "Failed to read build paths file \"%s\": %s",
893
893
"892": "Failed to resolve glob pattern \"%s\": %s",
894
-
"893": "The \"sassOptions.functions\" option is not supported when using Turbopack. Custom Sass functions are only available with webpack. Please remove the \"functions\" property from your sassOptions in %s."
894
+
"893": "The \"sassOptions.functions\" option is not supported when using Turbopack. Custom Sass functions are only available with webpack. Please remove the \"functions\" property from your sassOptions in %s.",
895
+
"894": "Param %s not found in childrenRouteParamSegments %s"
0 commit comments