Parallel Routes with Dynamic Routes #48340
Replies: 12 comments 3 replies
-
Any chance you figured this one out? Have a similar use case I want to work out |
Beta Was this translation helpful? Give feedback.
-
After some testing and re-reading the docs for the something that feels like the 100th time, I found the asnwer:
|
Beta Was this translation helpful? Give feedback.
-
For the record, the use case I was trying to use parallel routes was the following:
|
Beta Was this translation helpful? Give feedback.
-
@oswaldoacauan do you have an example of your /app directory structure you were using for this? |
Beta Was this translation helpful? Give feedback.
-
Similar problem here too - I guess the question is "How to manage interactions between parallel routes"? Also coming to the same conclusion as @oswaldoacauan. I guess interactions happen on the client, so it would sense that if you want a highly interactive interface, you're going to need to push more to the client. |
Beta Was this translation helpful? Give feedback.
-
@oswaldoacauan did you ever find a good solution for this? have an identical use case and been struggling to get everything smooth, current issue is that the list is refetched on all query parameter changes (say a ?selected="" to decide what content to show in the details view) The solution would be to somehow opt parallel routes out of specific search params so that @list could refetch with ?q,filters,date,etc and @details could refetch with ONLY the ?selected |
Beta Was this translation helpful? Give feedback.
-
I think I have found a solution to this problem. This is my file structure: ├── app
| ├── custom-path
| | ├── @fist-slot
| | | ├── default.tsx # <--------
| | | └── page.tsx
| | ├── @second-slot
| | | ├── [id]
| | | | └── page.tsx
| | | └── default.tsx # <--------
| | ├── error.tsx
| | ├── layout.tsx
| | └── not-found.tsx I have two slots (first-slot, second-slot). The first slot is a normal page. The second slot has a dynamic route. You can call this dynamic route with To load the content correctly, you need to use the default.tsx. I have imported the page.tsx there and returned it. default.tsx import Page from './page';
export default function Default() {
return <Page />;
} |
Beta Was this translation helpful? Give feedback.
-
I also have a similar use case, if someone finds a good solution apart from doing it all on the client side please help |
Beta Was this translation helpful? Give feedback.
-
yeah my understanding of parallel routes after experimenting is that they are meant to be isolated and don't handle the case of the list + preview UI pattern very well |
Beta Was this translation helpful? Give feedback.
-
So is the conclusion that parallel routing is not supposed to use with dynamic ones? |
Beta Was this translation helpful? Give feedback.
-
hey folks, any progress on this?? I've scratched my head whole week but no luck in getting it work. |
Beta Was this translation helpful? Give feedback.
-
Summary
Im still confused with parallel routes, most of examples I see was related to modals. but what if I actually want to render multiple of the same routes in 1 page?
Here's my case:
I have the following route:
date/@currentDate/[currentDate]/page.tsx
, which translates for example to /date/2023-04-13each page has a navigation Links with the previous 2 days, today and next 2 days. where the current date is the selected/active one
my layout.tsx looks like this:
the currentDate in layout will render the today's date, but I would like to know if its possible that I can specific say to render something like this:
I know this above snippet doesn't work but I hope it shows what Im looking for.
The intention is only render the previous day, current day, next day, always 3 days and they are dynamic because depends of what the current url date looks like.
Is this possible to achieve?
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions