-
Notifications
You must be signed in to change notification settings - Fork 26.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deep default.js is completely ignored #64708
Comments
Apologies for the confusion @aparx , the docs are outdated here and I'll work on a PR to fix them. Parallel routes currently only support a single default for the slot, and that default should be defined at the root of the slot. The params it receives would be for the dynamic segments leading up to it. |
The `params` example in the docs for `default.js` have the slot/params in the wrong order, giving the impression that you can deeply nest `default` slots. This clarifies that the params received by a slot are based on the dynamic params leading up to the segment containing the slot. Fixes #64708 Closes NEXT-3160
Hello, thanks for letting me know! Are there plans on adding default.js the way they were described? |
Hi @aparx -- there are not currently plans for this. Could you clarify a bit more what your desired behavior / use-case is? I could perhaps provide an alternate suggestion. |
Hey Tanner, I have a dashboard with three different parallel routes being displayed side by side. Some containing route params up to two directories deep. For some slots I need a default.js on different levels, to be able to use the supplied route parameters. I reckon I'm going to have to use normal pages, but the issue is they refetch on some soft navigation changes and also I'll kinda have to spam them in multiple places to get the desired behaviour, which is something I don't particularly want. I'm pretty certain I'll find a workaround that fits more with Next's design and concepts. So thanks for helping and good luck down the road. |
I'm also interested in this functionality and the ability to have deeply nested slots that run code. My use case is essentially when I'm working on React Three Fiber projects I like to have the canvas and the webgl layer as a slot and then html on the main routes. This separation allows me to organize my react three fiber code effectively and in parallel with the html code. |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://github.com/aparx/nextjs-deep-defaultjs-bug
To Reproduce
src
folder and app router@test/[id]/page.js
)@test/[id]/default.js
)[id]/page.js
) and add a subpage (e.g.:[id]/subpage/page.js
)/someRandomId/subpage
) - This should throw a 404Current vs. Expected behavior
What is the issue?
The default.js examples suggest that it is possible to contain
default.js
files deeper than the parallelroute itself. Such that subfolders can contain a version of default Next displays when
a fallback is needed. This does not work as proposed in 14.2.0 & 14.2.2 when using a
route parameter.
Expected behaviour & issue
The route file-tree looks like this:
Both are simultaneously rendered beneath each other in the root
layout.tsx
.We expect following when navigating to
/testId/
: (passed)@team/[teamId]/page.tsx
is rendered[teamId]/page.tsx
is renderedWe expect following when navigating to
/testId/settings
: (failed)@team/[teamId]/default.tsx
is rendered (Unexpected)[teamId]/settings/page.tsx
is rendered (Only under a condition, see below)By default, neither is rendered from point two, since a 404 is thrown. Only, when
adding a
default.js
at@team/
directly,[teamId]/settings/page.tsx
is rendered. The more deeplylocated default file is completely ignored.
Provide environment information
Which area(s) are affected? (Select all that apply)
Parallel & Intercepting Routes
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
I tested this reproduction with 14.0, 14.1 canary versions & the current latest 14.2.2
The text was updated successfully, but these errors were encountered: