vercel / next.js

The React Framework
https://nextjs.org
MIT License
127.51k stars 27.04k forks source link

Parallel routes and route groups conflicting #73119

Open chris-orgorg opened 1 week ago

chris-orgorg commented 1 week ago

Link to the code that reproduces this issue

https://github.com/chris-orgorg/parallel-routes

To Reproduce

  1. yarn dev
  2. visit http://localhost:3000/subfolder/mypage

Current vs. Expected behavior

Current:

No default component was found for a parallel route rendered on this page. Falling back to nearest NotFound boundary. Learn more: https://nextjs.org/docs/app/building-your-application/routing/parallel-routes#defaultjs

Missing slots: @breadcrumb Error Component Stack

Expected: / layout / subfolder layout / mypage page / subfolder/@breadcrumb page

Provide environment information

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:00 PDT 2024; root:xnu-10063.141.2~1/RELEASE_X86_64
  Available memory (MB): 40960
  Available CPU cores: 16
Binaries:
  Node: 22.0.0
  npm: 10.5.1
  Yarn: 1.22.22
  pnpm: 9.12.2
Relevant Packages:
  next: 15.0.3 // Latest available version is detected (15.0.3).
  eslint-config-next: 15.0.3
  react: 19.0.0-rc-66855b96-20241106
  react-dom: 19.0.0-rc-66855b96-20241106
  typescript: 5.7.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Parallel & Intercepting Routes

Which stage(s) are affected? (Select all that apply)

Vercel (Deployed)

Additional context

It seems that by having a route group (in this case (app)) at the same level as another subfolder, both using the same name for a parallel route (in this case @breadcrumb) causes the incorrect resolution for getting the parallel routes. Maybe the parallel routes are getting fetched by path (but route grouping doesn't show up in the path, so it's looking in the wrong place).

I would expect the parallel routes to resolve or search by actual folder structure.

Changing the parallel routes to different names will fix the issue.

mostafa6813 commented 6 days ago

just add default.js file to @breadcrumb slot

output:

/ layout /subfolder layout /subfolder/mypage page Default page

and if was http://localhost:3000/subfolder/other-route add default.js to subfolder

output:

/ layout /subfolder layout Default page /subfolder/@breadcrumb page