vercel / next.js

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

[...catchAll] inside parallel route @slot not matched when route is already defined outside slot #52720

Open lmatteis opened 1 year ago

lmatteis commented 1 year ago

Verify canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.16.0
      npm: 9.5.1
      Yarn: 1.22.19
      pnpm: 8.6.0
    Relevant Packages:
      next: 13.4.10
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
      typescript: N/A
    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/lmatteis/nextgram/tree/e3c817dbd80521bde67e066c6a3f99a862b2f081

To Reproduce

Describe the Bug

Given this folder structure

├── @langSlot
│   ├── article
│   │   └── [...catchAll]
│   │       ├── loading.js
│   │       └── page.js
│   ├── default.js
│   └── page.js
├── article
│   └── [foo]
│       └── page.js

Note how article/ is defined both on the root and inside the @langSlot:

Expected Behavior

Soft navigating to /article/foo should render app/@langSlot/article/[...catchAll]/page.js even with article/* defined outside the @langSlot

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

samcx commented 9 months ago

@lmatteis Unfortunately, this :repro: is not a minimal enough example for us to take a look at.

Can you confirm if you are still seeing this on the latest :nextjs: canary, and if yes provide us with a minimal :public-big: :repro: so we can take a look?

noxan commented 8 months ago

@samcx taking your nextgram example and following the instructions from https://nextjs.org/docs/app/building-your-application/routing/parallel-routes#closing-the-modal (*) - it does not work.

see https://github.com/noxan/nextjs-nextgram for an example (minimal changeset)

(*) the second section, where it states: "When using the Link component to navigate away from a page that shouldn't render the @auth slot anymore, we use a catch-all route that returns null."

noxan commented 8 months ago

also #61206 seems like the same issue to me, and https://github.com/vercel/next.js/discussions/50284#discussioncomment-7482282 is a whole discussion around this issue.

ItsWendell commented 3 weeks ago

Probably related: https://github.com/vercel/next.js/issues/71086