8000 `generateStaticParams` not Passing Parent Params to Child in Nested Dynamic Routes · Issue #53717 · vercel/next.js · GitHub
[go: up one dir, main page]

Skip to content
10B7D
generateStaticParams not Passing Parent Params to Child in Nested Dynamic Routes #53717
@nikolailehbrink

Description

@nikolailehbrink

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.

NEXT-1509

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0