Skip to content

Commit 9bc1c06

Browse files
committed
docs(build): clarify route shell examples in static path comments
- Show concrete routes before dynamic routes in examples - Use concrete values (e.g., `/1234/`) instead of dynamic segments for clarity - Explicitly mention "concrete route" relationships
1 parent 4babe3e commit 9bc1c06

File tree

1 file changed

+4
-4
lines changed
  • packages/next/src/build/static-paths

1 file changed

+4
-4
lines changed

packages/next/src/build/static-paths/app.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ interface TrieNode {
266266
* should throw an error when its static shell is empty.
267267
*
268268
* A route should not throw on empty static shell if it has child routes in the Trie. For example,
269-
* if we have two routes, `/blog/[slug]` and `/blog/first-post`, the route for
270-
* `/blog/[slug]` is a shell because it has a more specific child.
269+
* if we have two routes, `/blog/first-post` and `/blog/[slug]`, the route for
270+
* `/blog/[slug]` should not throw because `/blog/first-post` is a more specific concrete route.
271271
*
272272
* @param prerenderedRoutes - The prerendered routes.
273273
* @param routeParamKeys - The keys of the route parameters.
@@ -374,13 +374,13 @@ export function assignErrorIfEmpty(
374374
// following conditions is met:
375375
// 1. `hasChildren` is true: This node has further concrete parameter children.
376376
// This means the current route is a parent to more specific routes (e.g.,
377-
// `/blog/[slug]` is a shell if `/blog/first-post` exists).
377+
// `/blog/[slug]` should not throw when concrete routes like `/blog/first-post` exist).
378378
// OR
379379
// 2. `route.fallbackRouteParams.length > minFallbacks`: This route has
380380
// more fallback parameters than another route at the same Trie node.
381381
// This implies the current route is a more general version that should not throw
382382
// compared to a more specific route that has fewer fallback parameters
383-
// (e.g., `/[id]/[...slug]` is a shell for `/[id]`).
383+
// (e.g., `/1234/[...slug]` should not throw relative to `/[id]/[...slug]`).
384384
if (
385385
hasChildren ||
386386
(route.fallbackRouteParams &&

0 commit comments

Comments
 (0)