Is multiple root layout (shares same subroutes) possible? #63431
Unanswered
yoshi95
asked this question in
App Router
Replies: 1 comment 1 reply
-
A similar discussion happened here, but it is not specific to I dont know if similar work arounds applies to app router, specifically around the preload heuristics in app-router |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am building a site (using [email protected]) that has 2 top level entry route
both entry routes share the same subroutes, but with different css. I am able to achieve this with lots of duplication in sub-route folders, like the following
I am trying to remove the subroute duplication, by doing something like this
Attempt 1
layout.tsx
dynamic-importparams.type
is furnitureparams.type
is clothingbut this does not work because NextJS RSC will add preload tags for all css, overriding styles and loading fonts for both brand/subroutes
Attempt 2
I now try to use the concept of parallel routes with slots, conditionally rendering
@clothing
or@furniture
slot based on theparams.type
but again, NextJS adds preload tag for both css
Attempt 3
I randomly stumbled on this when searching for similar issues/discussions, that prefetch heuristics was updated, up to
loading boundary
https://github.com/vercel/next.js/pull/49077/files
without understanding the underlying code I added
loading.tsx
to each slot, hoping it would not preload the css file, and as expected it did not work.now I am out of ideas
I am now out of ideas on how to remove the duplication. I have a lot more microsites/landing page that has different top level layout/css to drive distinct branding from emails/search traffic, but all with same subroutes.
Would love to understand if this is doable at all, or how this could be achieve? I am assuming this is a common setup, open to suggestion if not.
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions