#Issue with intercepting and parallel routes

16 messages · Page 1 of 1 (latest)

lucid rune
#

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?

low lagoonBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

wintry sage
lucid rune
lucid rune
#

?

#

and what folder is that

wintry sage
#

... the ... intercept

lucid rune
#

(.)post?

#

thanks

lucid rune
#

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

lean sable
# lucid rune 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

lucid rune
#

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.

lean sable