T
TanStack•7mo ago
fair-rose

Multiple nested pathless layouts at the same level

Is it possible to have multiple pathless layout files at the same level? Specifically, I am looking to have multiple layout files at the root of my project to match the logical split. eg to have a different file per service that I want to inject into the conext before load I'll might want to have _service-1.tsx, _service-2.tsx
12 Replies
correct-apricot
correct-apricot•7mo ago
and you would want them all to match? then the answer is no can you please explain in more detail what you want to do here?
fair-rose
fair-roseOP•7mo ago
yes 😦 I want to separate my _authentication from my _layout So I have one file responsible for structure and another for auth I could imagine extending this pattern for DI
correct-apricot
correct-apricot•7mo ago
you can just import multiple components inside a single pathless route
fair-rose
fair-roseOP•7mo ago
Sure, there is a trivial workarounds, It just seems like a clearn alternative
correct-apricot
correct-apricot•7mo ago
how is that not clean? you want to compose components
fair-rose
fair-roseOP•7mo ago
Being able to drop in a single file without having to edit others seems cleaner to me than having create my logic and then explicitly bind it
correct-apricot
correct-apricot•7mo ago
how would that even work? how would you want to express the order?
fair-rose
fair-roseOP•7mo ago
Alphabetically, so if order matters a numerical prefix can be employed. All pathless routes matching the request would be invoked. eg / would match __root then _auth then _layout
correct-apricot
correct-apricot•7mo ago
and then what? they would nest?
fair-rose
fair-roseOP•7mo ago
Yep
correct-apricot
correct-apricot•7mo ago
sounds like a bit too much magic for my taste
fair-rose
fair-roseOP•7mo ago
That's fair enough, thank you for entertaining the thought, I appreciate your time 🙂

Did you find this page helpful?