nextjs - 💡(How to fix) Fix Intercepting route modal shows stale background after first open/close in production (App Router + parallel routes) [1 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#86035Fetched 2026-04-08 02:12:54
View on GitHub
Comments
0
Participants
1
Timeline
7
Reactions
4
Participants
Assignees
Timeline (top)
labeled ×3subscribed ×2assigned ×1issue_type_added ×1

Code Example

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 65447
  Available CPU cores: 32
Binaries:
  Node: 22.17.0
  npm: 10.9.2
  Yarn: 1.22.19
  pnpm: 10.13.1
Relevant Packages:
  next: 15.1.4 
  eslint-config-next: 15.1.4
  react: 19.2.0
  react-dom: 19.2.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/smitkhanparaZuru/parallel-old https://parallel-old.vercel.app/dark/chat

To Reproduce

When navigating between modals using Next.js Intercepting Routes and Parallel Routes, the background page incorrectly changes to /dark/chat instead of preserving the previous background page (e.g., /dark/discover).

Step-by-step:

  1. Initial State: Navigate to /dark/chat page

    • Background page shows: Chat Page ✓
  2. Open Profile Modal: Click on "Profile" link

    • Modal opens with Profile content ✓
    • Background page should remain: Chat Page ✓
  3. Navigate to Setting Modal: From Profile modal, click "Setting" link

    • Modal changes to Setting content ✓
    • Background page should remain: Chat Page ✓
  4. Navigate to Changelog Modal: From Setting modal, click "Changelog" link

    • Modal changes to Changelog content ✓
    • Background page should remain: Chat Page ✓
  5. Navigate back to Profile Modal: From Changelog modal, click "Profile" link

    • Modal changes to Profile content ✓
    • Background page should remain: Chat Page ✓
  6. Close Modal: Click the close (X) button

    • Modal closes ✓
    • Background page shows: Chat Page ✓
  7. Navigate to Discover Page: Click on "Discover" link

    • Background page shows: Discover Page ✓
  8. Open Profile Modal Again: Click on "Profile" link

    • Modal opens with Profile content ✓
    • Background page should show: Discover Page ✓
  9. Navigate to Setting Modal: From Profile modal, click "Setting" link

    • Modal changes to Setting content ✓
    • Background page should show: Discover Page ✓
  10. Navigate to Changelog Modal: From Setting modal, click "Changelog" link

    • Modal changes to Changelog content ✓
    • Background page should show: Discover Page ✓
  11. Navigate back to Profile Modal: From Changelog modal, click "Profile" link

    • Modal changes to Profile content ✓
    • BUG: Background page incorrectly changes to: Chat Page ❌
    • Expected: Background page should remain: Discover Page ✓

Current vs. Expected behavior

Current Behavior

When navigating between modals (Profile → Setting → Changelog → Profile) after being on the Discover page, the background page incorrectly changes to Chat Page instead of preserving the Discover page.

Expected Behavior

The background page should always preserve the last non-modal route that was visited. When navigating between modals, the background should remain unchanged regardless of which modal route is currently active.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 65447
  Available CPU cores: 32
Binaries:
  Node: 22.17.0
  npm: 10.9.2
  Yarn: 1.22.19
  pnpm: 10.13.1
Relevant Packages:
  next: 15.1.4 
  eslint-config-next: 15.1.4
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

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

Dynamic Routes, Parallel & Intercepting Routes, Runtime

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

Vercel (Deployed)

Additional context

No response

extent analysis

TL;DR

The issue can be resolved by properly handling the routing state when navigating between modals, ensuring the background page remains unchanged.

Guidance

  • Review the Next.js routing configuration to ensure that modal routes are not interfering with the background page routing state.
  • Verify that the useRouter hook from next/router is being used correctly to handle client-side routing between modals.
  • Check the implementation of Parallel Routes and Intercepting Routes to ensure they are not causing unintended routing behavior.
  • Consider adding a custom routing handler to preserve the last non-modal route when navigating between modals.

Example

No specific code example can be provided without modifying the original codebase, but reviewing the next/router documentation and ensuring correct usage of useRouter and routing configuration can help resolve the issue.

Notes

The provided environment information and package versions may be relevant to the issue, but without further context or code snippets, it's difficult to pinpoint the exact cause. The issue may be specific to the implementation of Parallel Routes and Intercepting Routes in Next.js.

Recommendation

Apply a workaround by implementing a custom routing handler to preserve the last non-modal route when navigating between modals, as the root cause of the issue is likely related to the routing configuration and not a specific package version.

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 - 💡(How to fix) Fix Intercepting route modal shows stale background after first open/close in production (App Router + parallel routes) [1 participants]