Next.js Discord

Discord Forum

Are parallel routes broken ???

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Barbary LionOP
Nextjs 14, trying to use parallel routes..

My first thought was this was me... But after lots of tests and checking other horror stories, it seems like this tech doesn't work 100%.

So I have:

app
-dashboard
--(overview)
---page.tsx
---loading.tsx
--@modal
---default.tsx
---page.tsx
--settings
---page.tsx
...
...
-layout.tsx
page.tsx
layout.tsx

(hopefully above is clear).

I have a page + layout under app, i then have a dashboard sub route, with it's own page (in group overview) and it's own layout. (this layout wraps everything in dashboard.

The layout that wraps dashboard (parent to modal is rendering the modal always)

(removed stuff for brevity)

<div>
{children}
{modal}
</div>


I have a @modal slot under dashboard, with a default and a page.

My understanding is this: (Made more complicated by the fact dev + production build have diff approaches)(also soft + hard nav change things too)

I should be always rendering modal page alongside the dashboard page:
- This only happens when first loading dashboard page or HARD reloading it. Soft reloading via LINK does not render modal.

Soft navigating to other page like settings for example (where modal does not have a page):
I thought default would proc, but apparently just the modal page should stay rendered (soft nav). (and this does not happen)

Hard navigation should proc default, and it does! ... sometimes... Which is very very strange, I'd go to a page and render the modal default (hard nav), then I'd hard nav to another page and not get the modal.

I've been at this for several hours, forgive my explanation not being too clear, trying to make sense of what parralel routes are meant to do in different scenarios has melted my brain.

There seems to be different behaviour for dev than build, soft nav with links vs hard nav with url (or refresh), and I'm not even getting consistency with that.

0 Replies