Next.js Discord

Discord Forum

Parallel/Intercepting routes not working

Unanswered
Alligator mississippiensis posted this in #help-forum
Open in Discord
Alligator mississippiensisOP
Repro: https://github.com/owen-dyer/parallel-intercepting-routes-test

If you navigate to the home page (/) and click on the 'login' or 'signup' links in the top left you will get a 404 page not found error. If you navigate to /login or /signup directly (manually change the url) it will take you to the page. I believe this is an issue with route groups, however, I am not sure.

19 Replies

Alligator mississippiensisOP
I just tested the exact same thing but I moved
@modal login & signup
directories out of the
(auth)
route group
It worked totally fine with these changes so there is a bug with route groups and intercepting/parallel routes
Ok I found the problem, you have to create a layout under the route group in order to use intercept routes
So in (auth)/layout.tsx
import Navbar from '@/components/navigation/Navbar'

export default function AuthLayout(
  props: {
    children: React.ReactNode, modal: React.ReactNode,
  }) {
  return (
    <>
        {props.children}
        {props.modal}
    </>
  )
}

And remove props.modal from the root layout.
Alligator mississippiensisOP
I can do it the way that you have suggested and it will work also but it would be nice to have it in the root layout
I don't sure if it's a bug or something, you can report it in their Github repository
@fuma I don't sure if it's a bug or something, you can report it in their Github repository
Alligator mississippiensisOP
it seems like it might be a bug since the point of route groups is that they are ignored
but it might be intended
I will try what you posted above
thank you for helping 🙂
do I need a page.tsx in (auth)/ also?
it is trying to access the page but doesnt work
Alligator mississippiensisOP
Another update:
When I am on /login or /signup (from manually entering the url) and I click on the /login or /signup link in the navbar the modal opens just fine
However, when I am on the home page (/) and I click on the /login or /signup links in the navbar I get a 404 and I must enter the url manually