Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Use a parallel route slot and an intercepted route to show a destination such as /login in a modal during client-side navigation, while keeping that same URL usable as a full page when opened directly or refreshed. The key is to define both route states, provide an explicit default.tsx fallback for the slot, and choose a close behavior that matches how the modal was opened.
How parallel and intercepting routes work together
A parallel route is a named slot rendered by a shared layout. A folder such as @auth supplies an auth prop to that layout; the slot name does not become part of the URL. The implicit children prop is another slot. The layout can render the normal page and the modal slot together. Next.js documentation on Parallel Routes
As an Amazon Associate I earn from qualifying purchases.
An intercepting route lets a destination render within the current layout during client-side navigation. For example, a link to /login can update the browser URL to /login while displaying login content in an overlay. Opening or refreshing /login directly instead renders the standalone login page. Next.js documentation on Intercepting Routes
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchSet up the routes and fallback
This minimal structure uses a shared login-content component so both route presentations show the same form:
#1 Best Overall
app/
layout.tsx
login/
page.tsx
@auth/
default.tsx
(.)login/
page.tsx
The root layout renders both slots:
// app/layout.tsx
export default function RootLayout({
children,
auth,
}: {
children: React.ReactNode
auth: React.ReactNode
}) {
return (
<html lang="en">
<body>
{children}
{auth}
</body>
</html>
)
}
Use a shared content component rather than putting modal behavior into the form itself. That lets the content remain a Server Component if it does not need client-side behavior.
// app/login/page.tsx
import LoginContent from "@/components/login-content"
export default function LoginPage() {
return <LoginContent />
}
The intercepted route wraps the same content in your modal component:
Rank #2
// app/@auth/(.)login/page.tsx
import LoginContent from "@/components/login-content"
import Modal from "@/components/modal"
export default function LoginModal() {
return (
<Modal>
<LoginContent />
</Modal>
)
}
For the slot’s unmatched hard-load fallback, return null:
// app/@auth/default.tsx
export default function DefaultAuth() {
return null
}
In Next.js 16, every parallel route slot requires an explicit default.js file; the upgrade guide says builds fail without these defaults. Keep the fallback even if the slot is usually empty. Confirm the requirement against the version installed in your app. Next.js 16 upgrade guide Next.js documentation on default.js
Rank #3
Choose the interception matcher by route depth
The matcher counts URL route segments, not every directory in the filesystem. In particular, a named slot such as @auth is not a route segment. That is why the example uses (.)login even though the intercepted route lives inside the @auth directory. Next.js documentation on Intercepting Routes
(.)matches at the same route-segment level.(..)matches one route segment up.(..)(..)matches two route segments up.(...)matches from the app root.
Work out the URL segment relationship between the route where navigation starts and the destination, then select the matcher. Do not count route groups, slots, or physical folders as URL segments unless they actually create a route segment.
What changes on navigation, refresh, and back
During soft navigation, Next.js partially renders the changed slot and can preserve active subpages in other slots even when those subpages do not match the new URL. On a hard navigation or refresh, it cannot recover unmatched slot state, so it uses the slot’s default.js fallback. If a required fallback is missing, the result can be an error or 404 depending on the route and framework version. Next.js documentation on Parallel Routes Next.js guidance for a missing parallel-route default
For the login example, the intended states are:
- Navigate from another page using a client-side link to
/login: the intercepted route shows the modal and the URL becomes/login. - Load or refresh
/logindirectly: the full-page route renders. - Load another URL that has no active auth-slot route: the slot’s default returns
nullon a hard load.
Make dismissal predictable
Choose a close action based on the navigation history and the state of the slot. Do not rely on an unmatched slot disappearing automatically during soft navigation.
Best Value
Use browser history when there is a meaningful previous state
If the user opened the modal from a page they should return to, a client-side close button can call router.back(). This follows the same history entry created by opening the destination, so the underlying page reappears. It is a poor fit when users can arrive at the modal URL without a meaningful prior in-app page.
Navigate to a route that clears the slot
Another option is a link to a route handled in the modal slot by a page that returns null. This explicitly clears the slot rather than asking the browser to infer which page to restore.
Clear the slot for other destinations
If users can navigate elsewhere while the modal slot remains active, add an appropriate catch-all route in that slot that returns null. Next.js documents this pattern for clearing a slot on navigation to other paths. Test the routes your app supports so the catch-all does not conflict with a more specific slot route. Next.js documentation on Parallel Routes
Decide when this pattern is appropriate
Use interception when the destination needs a real, shareable URL and users benefit from seeing it without losing the current page context. Next.js documents examples such as opening a photo from a feed, showing login from a navbar, or displaying a shopping cart in a side modal. Next.js documentation on Intercepting Routes
Quick Recap
- Standalone destination: implement a full-page route when direct visits and refreshes must show the destination independently of the page that opened it.
- Preserved context: add interception when opening the destination should retain the visible page beneath an overlay.
- Navigation semantics: decide whether close should return through browser history or explicitly navigate to a state that clears the slot.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




