help me understand parallel routes
Unanswered
Asiatic Lion posted this in #help-forum
Asiatic 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.
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
@Asiatic Lion 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.
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.
because if the route doesn't exist next will be confused what to put in
{ notification } and result in redirection to 404.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
/complex-dashboard/@notifications/[...slugs]/page.tsx that way you gain access to fallback parallel components and also
slug to make useful breadcrumbs and stuff@/* @__PURE__ */ alfonsus 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
Asiatic 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
@/* @__PURE__ */ alfonsus if you dont create a default.tsx, then it will throw 404
Asiatic 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?
Asiatic LionOP
thanks again
@Asiatic Lion thanks again
dont forget to mark the message that is most useful!
@/* @__PURE__ */ alfonsus dont forget to mark the message that is most useful!
Asiatic LionOP
ok how do i do that. and how do i udpate it to solved?