nextjs - ✅(Solved) Fix Parallel routes not working inside dynamic page, when in same segment [1 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#84813Fetched 2026-04-08 02:18:14
View on GitHub
Comments
2
Participants
3
Timeline
14
Reactions
0
Assignees
Timeline (top)
referenced ×5commented ×2labeled ×2assigned ×1

Error Message

Fix Action

Fixed

PR fix notes

PR #84898: Interception routes match from nested route navigation

Description (problem / solution / changelog)

What?

Refactors interception route regex generation to fix nested route navigation and improve maintainability.

Why?

Interception routes failed to trigger when navigating from nested descendant routes. The previous implementation had overly complex, fragile regex patterns spread across multiple functions that were difficult to maintain and didn't handle all navigation scenarios correctly.

The root cause was an overly restrictive header matching pattern (/[^/]+ - single segment only) that prevented matching navigation from deeper nested routes like /groups/123/settings/groups/123/new.

How?

Simplified Architecture:

  • Consolidated regex generation logic into route-regex.ts where it properly belongs
  • Removed ~230 lines of complex, duplicated regex building code from generate-interception-routes-rewrites.ts
  • Leveraged existing getNamedRouteRegex() with a new reference parameter to handle parameter name mapping

Parameter Naming Fix:

  • Introduced nxtI prefix for parameters adjacent to interception markers (e.g., (.)[id]nxtIid)
  • Maintains nxtP prefix for regular parameters
  • Ensures consistent parameter naming across source, destination, and regex patterns

Regex Pattern Fix:

  • Changed header matching from single-segment (/[^/]+)? to multi-segment (/.+)? pattern
  • Now correctly matches navigation from any descendant route depth

Test Coverage:

  • Added comprehensive e2e tests for nested navigation scenarios
  • Updated existing tests to reflect new parameter naming convention

Fixes #84813

NAR-445

Changed files

  • packages/next/src/lib/generate-interception-routes-rewrites.test.ts (modified, +783/-123)
  • packages/next/src/lib/generate-interception-routes-rewrites.ts (modified, +14/-252)
  • packages/next/src/shared/lib/router/utils/interception-routes.ts (modified, +21/-4)
  • packages/next/src/shared/lib/router/utils/route-regex.test.ts (modified, +89/-31)
  • packages/next/src/shared/lib/router/utils/route-regex.ts (modified, +29/-12)
  • test/e2e/app-dir/interception-dynamic-segment-middleware/interception-dynamic-segment-middleware.test.ts (modified, +54/-4)
  • test/e2e/app-dir/interception-dynamic-segment/interception-dynamic-segment.test.ts (modified, +42/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/@modal/(.)[a]/[b]/[c]/item/page.tsx (added, +10/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/@modal/(.)admin/dashboard/users/new/page.tsx (added, +3/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/@modal/(.)groups/[id]/new/page.tsx (added, +6/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/@modal/(.)org/[orgId]/team/[teamId]/settings/page.tsx (added, +10/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/@modal/[a]/[b]/[c]/page.tsx (added, +3/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/@modal/admin/dashboard/users/page.tsx (added, +3/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/@modal/default.tsx (added, +1/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/@modal/groups/[id]/page.tsx (added, +3/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/@modal/org/[orgId]/team/[teamId]/page.tsx (added, +3/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/[a]/[b]/[c]/item/page.tsx (added, +10/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/[a]/[b]/[c]/page.tsx (added, +17/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/admin/dashboard/users/new/page.tsx (added, +3/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/admin/dashboard/users/page.tsx (added, +12/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/default.tsx (added, +3/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/groups/[id]/new/page.tsx (added, +6/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/groups/[id]/page.tsx (added, +15/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/layout.tsx (added, +17/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/org/[orgId]/team/[teamId]/page.tsx (added, +20/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/org/[orgId]/team/[teamId]/settings/page.tsx (added, +10/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/app/page.tsx (added, +20/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/interception-dynamic-single-segment.test.ts (added, +302/-0)
  • test/e2e/app-dir/interception-dynamic-single-segment/next.config.js (added, +6/-0)
  • test/e2e/app-dir/interception-segments-two-levels-above/interception-segments-two-levels-above.test.ts (modified, +60/-2)

Code Example

app/
├─ groups/
│  ├─ [id]/
│  │  ├─ new/
│  │  │  ├─ page.tsx
│  │  ├─ page.tsx
├─ @modal/
├─ (.)groups/
│  │  ├─ [id]/
│  │  │  ├─ new/
│  │  │  │  ├─ page.tsx
│  ├─ default.tsx
├─ page.tsx

---

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:39 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 20.12.2
  npm: 10.5.0
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 16.0.0-canary.3 // Latest available version is detected (16.0.0-canary.3).
  eslint-config-next: 16.0.0-canary.3
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/FacundoSpira/parallel-routes-error

To Reproduce

I have the following file structure:

app/
├─ groups/
│  ├─ [id]/
│  │  ├─ new/
│  │  │  ├─ page.tsx
│  │  ├─ page.tsx
├─ @modal/
│  ├─ (.)groups/
│  │  ├─ [id]/
│  │  │  ├─ new/
│  │  │  │  ├─ page.tsx
│  ├─ default.tsx
├─ page.tsx

In both the / and groups/[id] routes I have Links to groups/123/new. When clicking it from the / page, it correctly opens the parallel route, but when clicking it from the groups/123 page, it's redirecting to the actual page, and not the parallel route. This only happens when the route is inside a dynamic group ([id]).

Current vs. Expected behavior

Expected: both links should open the parallel route.

Additional note: this started happening after upgrading from the 15.6.0-canary.53 version. The reproduction example has two branches:

  • main: using next version 16.0.0-canary.3
  • 15.6.0-canary.53: using 15.6.0-canary.53. Parallel routes work fine here in both cases

16.0.0-canary.3

https://github.com/user-attachments/assets/dbc4bb39-1129-4425-8e25-e80c1df0c435

15.6.0-canary.53

https://github.com/user-attachments/assets/97e26043-cbbb-4ae8-a0ed-a465f72a5acc

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:39 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 20.12.2
  npm: 10.5.0
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 16.0.0-canary.3 // Latest available version is detected (16.0.0-canary.3).
  eslint-config-next: 16.0.0-canary.3
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.9.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)

next dev (local), next build (local), next start (local), Vercel (Deployed), Other (Deployed)

Additional context

No response

extent analysis

TL;DR

The issue with parallel routes not working as expected after upgrading to Next.js version 16.0.0-canary.3 can be resolved by downgrading to version 15.6.0-canary.53 or waiting for a fix in a future version.

Guidance

  • The problem seems to be related to the upgrade from version 15.6.0-canary.53 to 16.0.0-canary.3, as the reproduction example works fine in the older version.
  • To verify the issue, compare the behavior of the links in the / and groups/[id] routes between the two versions.
  • Try downgrading to version 15.6.0-canary.53 to see if the issue is resolved.
  • If downgrading is not feasible, consider waiting for a future version of Next.js that may include a fix for this issue.

Notes

  • The issue is specific to parallel routes inside dynamic groups ([id]) and only occurs when using version 16.0.0-canary.3.
  • The provided reproduction example and environment information suggest that the issue is not related to the operating system, Node version, or other dependencies.

Recommendation

  • Apply workaround: Downgrade to version 15.6.0-canary.53, as it is the last known working version for this specific issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - ✅(Solved) Fix Parallel routes not working inside dynamic page, when in same segment [1 pull requests, 2 comments, 3 participants]