Next.js Discord

Discord Forum

Is dynamic parallel route possible?

Answered
Barbary Lion posted this in #help-forum
Open in Discord
Barbary LionOP
Im trying to create modals that would display different content based on route parameters.

My structure:

-- app/
-- team/
|-- @memberModal
| -- [memberId]
| -- page.tsx
|-- layout.tsx
-- page.tsx

The desired result would be to display the modal above the team page for a route like /team/[id] (and fetch data for the member dynamically) , but hide it for the /team url

However, for this folder structure when i go to team/[id] i get 404. Any advice?

Thank you
Answered by Barbary Lion
I have solved the problem - the tricky part is that dynamic slots are rendered when navigated to with a <Link> component. After the dynamic route gets rendered and the client refreshes - then we will get a 404. To remedy the problem i created a /team/default.tsx whos only job is to redirect back to /team. This way we get the dynamic modals and, we restrict the user from getting into /team/[memberId] directly .
View full answer

1 Reply

Barbary LionOP
I have solved the problem - the tricky part is that dynamic slots are rendered when navigated to with a <Link> component. After the dynamic route gets rendered and the client refreshes - then we will get a 404. To remedy the problem i created a /team/default.tsx whos only job is to redirect back to /team. This way we get the dynamic modals and, we restrict the user from getting into /team/[memberId] directly .
Answer