Next.js Discord

Discord Forum

Issue with intercepting and parallel routes

Unanswered
Nile Crocodile posted this in #help-forum
Open in Discord
Nile CrocodileOP
Hello. I'm working on social media app. Here's file/folder structure of my app directory:
app
│   favicon.ico
│   globals.css
│   layout.tsx
│   page.tsx
│   
├───@dialog
│   │   default.tsx
│   │   
│   └───(.)post
│       └───[id]
│               page.tsx
│               
└───post
    ├───new
    │       page.tsx
    │       
    └───[id]
            page.tsx

As you can see I'm using intercepting routes to display post details in dialog instead of redirecting user to separate page.
You can also notice I have /post/new route (which takes me to form to create new post). Well I'm facing issue with that /post/new route. When I try to go to that route, I get 404 Not Found error, however hard-reload successfully takes me to the form. So I'm guessing issue is I don't have intercepting route for /post/new route. Has anyone faced this issue before? And how to fix it?

15 Replies

@Knopper gall this is intended behaviour, you do not have default.tsx
Nile CrocodileOP
Where is default.tsx supposed to be? I have one inside of @diaolog folder.
Nile CrocodileOP
?
and what folder is that
Knopper gall
... the ... intercept
Nile CrocodileOP
(.)post?
thanks
Nile CrocodileOP
nevermind that didn't work
default.tsx is supposed to just return null right?
and I can't seem to find anything about putting default.tsx in intercept in Next.js docs
@Nile Crocodile default.tsx is supposed to just return null right?
You dont need default.tsx in the intercept route
Because you are intercepting/post so you need to add a route at (.)post/new/page.tsx but this may not be what you want
I had this problem before and still looking for a way to fix it
I ended up creating the route in different segment eg /new-post
Nile CrocodileOP
Yeah I had that in mind as alternative as well. I tried to find a way to somehow redirect user from (.)post/new to actual /post/new page, but can't seem to find a way to do it without hard reloading the page.
I will try it later tho