Next.js Discord

Discord Forum

Disable Route Interception for nested routes

Unanswered
Irish Red and White Setter posted this in #help-forum
Open in Discord
Avatar
Irish Red and White SetterOP
I am currently working on a Next.js project where I have implemented a modal that opens when navigating to a specific route (e.g., /[id]/). This functionality is working as expected.
However, I have encountered a challenge when trying to open a different page within the same modal. While I have managed to achieve this, I am facing an issue when the user is on the standard page (the non-modal route) and clicks a link to open the subpage. In this scenario, the subpage is intercepted and opens in a modal, which is not the desired behavior.
To illustrate, I attached my folder structure.

I am looking for a way to disable route interception for this specific case, so that when the user is on the standard page and clicks the link to the subpage, it opens as a standard page rather than in a modal.

[Edit phibr0/next-intercepted-modal/main on codesandbox](https://codesandbox.io/p/github/phibr0/next-intercepted-modal/main?file=%2Fapp%2Fpage.tsx&embed=1)
Image

0 Replies