Commit 39400b6
committed
fix(build): enable prerendering of interception routes with generateStaticParams
Fixes a bug where interception routes in parallel slots could not be prerendered
using generateStaticParams. The previous implementation only examined "children"
segments when building static paths, missing segments from parallel routes that
contribute to the pathname.
Introduces extractPathnameSegments() which:
- Traverses the entire loader tree (children + parallel routes) using BFS
- Correctly tracks URL depth (skipping route groups/parallel markers, including
interception markers which are actual URL components)
- Validates that static segment prefixes match the target pathname
- Returns ALL segments that contribute to pathname construction
This enables routes like app/@modal/(.)photo/[id] to be prerendered when they
export generateStaticParams, fixing 404 responses that occurred when these
routes were accessed directly.1 parent 482ed70 commit 39400b6
File tree
14 files changed
+3146
-1690
lines changed- packages/next
- src
- build
- segment-config/app
- static-paths
- server
- dev
- request
- test/e2e/app-dir/interception-dynamic-segment
- app/@modal/(.)[username]/[id]
14 files changed
+3146
-1690
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
924 | 924 | | |
925 | 925 | | |
926 | 926 | | |
927 | | - | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
928 | 930 | | |
Lines changed: 12 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
21 | | - | |
22 | | - | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
223 | 224 | | |
224 | 225 | | |
225 | 226 | | |
226 | | - | |
227 | | - | |
228 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
229 | 230 | | |
230 | 231 | | |
231 | | - | |
| 232 | + | |
232 | 233 | | |
233 | | - | |
| 234 | + | |
234 | 235 | | |
235 | | - | |
236 | | - | |
| 236 | + | |
| 237 | + | |
237 | 238 | | |
238 | 239 | | |
239 | 240 | | |
| |||
248 | 249 | | |
249 | 250 | | |
250 | 251 | | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
| 252 | + | |
259 | 253 | | |
260 | 254 | | |
261 | 255 | | |
| |||
0 commit comments