Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generateStaticParams breaks intercepting routes #52880

Closed
1 task done
Netail opened this issue Jul 19, 2023 · 11 comments · Fixed by #67400
Closed
1 task done

generateStaticParams breaks intercepting routes #52880

Netail opened this issue Jul 19, 2023 · 11 comments · Fixed by #67400
Labels
bug Issue was opened via the bug report template. locked Parallel & Intercepting Routes Related to Parallel and/or Intercepting routes.

Comments

@Netail
Copy link
Contributor

Netail commented Jul 19, 2023

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.5.0: Thu Jun  8 22:22:22 PDT 2023; root:xnu-8796.121.3~7/RELEASE_X86_64
    Binaries:
      Node: 16.18.0
      npm: 8.19.2
      Yarn: 1.22.19
      pnpm: 8.6.1
    Relevant Packages:
      next: 13.4.11-canary.0
      eslint-config-next: 13.4.9
      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/Netail/app-dir-intercept

To Reproduce

  1. Create a project which uses parallel route and intercepting, something like;
.
└── [locale]/
    ├── (program)/
    │   ├── programma/
    │   │   └── [slug]/
    │   │       └── [id]/
    │   │           └── page.jsx
    │   └── program/
    │       └── [slug]/
    │           └── [id]/
    │               └── page.jsx
    ├── @modal/
    │   ├── (.)programma/
    │   │   └── [slug]/
    │   │       └── [id]/
    │   │           └── page.jsx
    │   └── (.)program/
    │       └── [slug]/
    │           └── [id]/
    │               └── page.jsx
    └── layout.jsx
  1. Add a generateStaticParams in the root layout

Describe the Bug

generateStaticParams in the root layout prevents route intercepting, causing to render the actual page instead of the intercepted component

Expected Behavior

Display intercept component instead of the actual page

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@Netail Netail added the bug Issue was opened via the bug report template. label Jul 19, 2023
@casperiv0
Copy link
Contributor

I'm also able to reproduce this bug in production (Vercel). Repository details:

    Operating System:
      Platform: linux
      Arch: x64
      Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023
    Binaries:
      Node: 18.17.0
      npm: 9.6.7
      Yarn: 1.22.19
      pnpm: 8.6.7
    Relevant Packages:
      next: 13.4.12
      eslint-config-next: 13.4.8
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.6
    Next.js Config:
      output: N/A

@Netail
Copy link
Contributor Author

Netail commented Aug 13, 2023

Mhmm, I feel like intercepting routes is a complete mess in its current state

@yuuhn
Copy link

yuuhn commented Nov 6, 2023

I'm experiencing the same issue but without using generateStaticParams in my project. My folder structure is as follows:

app
  [user]
    page.tsx
  @profile
    (.)[user]
      page.tsx
  layout.tsx
  page.tsx

next.js 14.0.1

@Neo-Ciber94
Copy link

generateStaticParams works for me but when I use output: "export" the app breaks and render the normal route ignoring the interception

@SamHendry
Copy link

@Neo-Ciber94 I am experiencing a similar issue. I have a modal with an intercepting route in it - /@modal/(..)[slug]/page.tsx - which works perfectly fine normally but when I set output: "export" the normal route is rendered and it throws the error

Error: Page "/search/(..)[club]" is missing "generateStaticParams()" so it cannot be used with "output: export" config.

even though I do in fact export this function in the page.tsx and it works without static exports.

@EdVonTech

This comment has been minimized.

@prananta
Copy link

Happened to me too. But then I fixed it by exporting generateStaticParams from the page.tsx instead of layout.tsx. Seems like exporting generateStaticParams from layout breaks the intercepting route.

@balazsorban44 balazsorban44 added the Parallel & Intercepting Routes Related to Parallel and/or Intercepting routes. label Apr 19, 2024
@mikebuilds
Copy link

+1 same issue! generateStaticParams in a layout breaks interception!

@Netail
Copy link
Contributor Author

Netail commented Jul 3, 2024

Muchas gracias 🏄‍♂️

Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked Parallel & Intercepting Routes Related to Parallel and/or Intercepting routes.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants