Next.js Discord

Discord Forum

help me understand parallel routes

Unanswered
Cape lion posted this in #help-forum
Open in Discord
Cape lionOP
i have posted a picture of my folder structure.
the tutorial im following said that you need to create a default.tsx file in order to retain the web page when you refresh the page when youre inside a sub directory, in this case, inside "/complex-dashboard/archived". but it mentions very little about why it should be.

ChatGPt on the other hand said that when you first type the url complex-dashboard , the default.tsx files load inside every @slots. but i found this not to be true, and instead page.tsx shows up and default.tsx only gets displayed when you reload the page when your inside a sub route.

so what really is the case. I would be very grateful if anyone helped me understand what it is about.

15 Replies

default.tsx is basically just a fallback incase you havent matched the routes parallely
like if you created a /complex-dashboard/asdf/page.tsx but not /complex-dashboard/@notifications/asdf/page.tsx
otherway to do this that i sometimes like to do is to use the spread slug like
/complex-dashboard/@notifications/[...slugs]/page.tsx that way you gain access to fallback parallel components and also slug to make useful breadcrumbs and stuff
@alfonsüs ardani otherway to do this that i sometimes like to do is to use the spread slug like /complex-dashboard/@notifications/[...slugs]/page.tsx that way you gain access to fallback parallel components and also `slug` to make useful breadcrumbs and stuff
Cape lionOP
ok so if you do /comples-dashboard/archived. it will look for archived sub route for all the @slots, so you create a default.tsx and even if a single route is not found, it will throw 404. is that correct?
if you create a default.tsx, it wont throw 404
if you dont create a default.tsx, then it will throw 404
@alfonsüs ardani if you dont create a default.tsx, then it will throw 404
Cape lionOP
and the reason being if you go to /complex-dashboard/archived, (archived is a sub route segment inside @notifications), and reload the page, it will look for archived in @revenue and @users as well, is that correct?
Cape lionOP
thanks again
@Cape lion thanks again
dont forget to mark the message that is most useful!
@alfonsüs ardani dont forget to mark the message that is most useful!
Cape lionOP
ok how do i do that. and how do i udpate it to solved?