-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Description
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 22.2.0: Fri Nov 11 02:08:47 PST 2022; root:xnu-8792.61.2~4/RELEASE_X86_64
Binaries:
Node: 18.12.1
npm: 9.7.1
Yarn: 1.22.19
pnpm: 8.6.6
Relevant Packages:
next: 13.4.14-canary.0
eslint-config-next: 13.4.13
react: 18.2.0
react-dom: 18.2.0
typescript: 5.1.6
Next.js Config:
output: N/A
Which area(s) of Next.js are affected? (leave empty if unsure)
App Router
Link to the code that reproduces this issue or a replay of the bug
https://github.com/nikolailehbrink/generateStaticParams-Bug
To Reproduce
- Clone the GitHub repository that contains the bug.
- Install the necessary dependencies.
- Start the development server.
- Navigate to a nested route such as http://localhost:3000/12314/iasd.
- Observe that the child page is accessible and the slug parameter is not available in the child's
generateStaticParams
.
Describe the Bug
I encountered a bug when using the generateStaticParams
function with nested dynamic routes in Next.js. The parent's parameters are not being passed to the child's generateStaticParams
, causing unexpected behavior in the generated static pages. According to the documentation, the expected behavior is:
Generate the parent segments first and use the result to generate the child segments.
However, in the provided example, the behavior is not consistent with this documentation, and the slug parameter from the parent route does not get passed to the child.
Expected Behavior
Expected Behavior:
The slug parameter generated in the parent's generateStaticParams
should be available in the child's generateStaticParams
.