[bug]: intercepting routes cannot go back outside dynamic params
Opened this issue · 1 comments
Link to the code that reproduces this issue
https://github.com/juliusmarminge/next-intercepting-routes
To Reproduce
- Deploy the project. This issue works when running locally (both
next dev
andnext start
). - Navigate down the tree until you get to an "app"-segment (e.g. https://next-intercepting-routes-one.vercel.app/dashboard/1/1)
- Click on a card, it should open as a modal but instead it hard navigates
Current vs. Expected behavior
Locally it does what you expect, deployed it hard-navigates and checking server logs reveals this error:
But that doesn't make any sense since the /dashboard/[team]/audit
page doesn't expect the appId
param, and on the /dashboard/[team]/[appId]
page it should be present. Are you only tracking 1 URL?
Demo:
https://github.com/user-attachments/assets/22a21b29-a18f-4d62-8db6-f469f80fc014
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.2.0: Fri Nov 15 19:28:48 PST 2024; root:xnu-11215.61.3~1/RELEASE_ARM64_T6000
Available memory (MB): 16384
Available CPU cores: 8
Binaries:
Node: 20.18.0
npm: 10.8.2
Yarn: N/A
pnpm: 10.0.0-alpha.0
Relevant Packages:
next: 15.1.1-canary.0 // Latest available version is detected (15.1.1-canary.0).
eslint-config-next: N/A
react: 19.0.0
react-dom: 19.0.0
typescript: 5.5.3
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
I cannot move the modal up above the appId
segment since I don't want the modal to show when navigating from /[team]
to /[team]/audit
for example.
Also tried to create a route group between the two and mounting the modal there, without success.
At the end I even tried with a hacky workaround to do conditional hard navigations but that resulted in a whole other class of problems
Are you only tracking 1 URL?
Did some debugging on this and search aprams are persisiting on the old route so the URL seems to be tracked correctly: juliusmarminge/next-intercepting-routes#2