vercel / vercel/next.js

Intercepting Routes trigger when navigating to the same route

Open
#82,934 3 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

linear: next Parallel & Intercepting Routes
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/agitated-shtern-3hmmyv

To Reproduce

File structure

app/
├── (auth)/
│   ├── signin/
│   │   └── page.jsx
│   └── default.jsx
└── @authModal/
    ├── default.jsx
    └── (.)signin/
        └── page.jsx

Intercepting route code (@authModal/(.)signin/page.jsx)

"use client";

import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
} from "@/components/ui/dialog"
import { useRouter } from "next/navigation";
import { useState } from "react";

const page = () => {
  const [open, setOpen] = useState(true);
  const router = useRouter();

  const handleClose = () => {
    setOpen(false); 
    setTimeout(() => {
      router.back();
    }, 200);
  };
  
  return (
    <Dialog open={open}>
      <DialogContent onBtnClickClose={handleClose} onOverlayClickClose={handleClose}>
        <DialogHeader>
          <DialogTitle>Sign In</DialogTitle>
          <DialogDescription>Modal opened via intercepting route</DialogDescription>
        </DialogHeader>
      </DialogContent>
    </Dialog>
  )
}

export default page

Navigation code

// This triggers the issue
router.push("/signin", { scroll: false })
Current vs. Expected behavior

Current behavior
Navigate to /signin from home page → Modal opens (✅ Expected)
Already on /signin page, click button that does router.push("/signin") → Modal opens (❌ Unexpected)

Expected behavior
The intercepting route should only trigger when navigating TO /signin FROM a different route, not when already on the /signin route itself.

Provide environment information
Next.js version: 15.4.7
React version: 19.1.0
Node.js version: 22.15.0
Which area(s) are affected? (Select all that apply)

Parallel & Intercepting Routes

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

next dev (local)

Additional context

I'm not sure if this is a bug or intended behavior, but it seems counterintuitive. When you're already on a page and navigate to the same page, it shouldn't trigger route interception.
The issue makes it impossible to have navigation to the same route without manually tracking navigation context, which defeats the purpose of automatic route interception.

NEXT-4717

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior in the linked CodeSandbox using the app/(auth)/signin/page.jsx and @authModal/(.)signin/page.jsx routes, then trace the router.push("/signin", { scroll: false }) entry point through Next.js parallel and intercepting route handling. Done means navigation from another route still opens the modal, while pushing the current /signin route does not.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, react
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.