Skip to content
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

Layout nesting simply wraps Page wherever it is in the tree. #1583

Closed
traviscooper opened this issue Mar 29, 2024 · 3 comments
Closed

Layout nesting simply wraps Page wherever it is in the tree. #1583

traviscooper opened this issue Mar 29, 2024 · 3 comments
Labels
enhancement ✨ New feature or request

Comments

@traviscooper
Copy link
Sponsor

Description

Currently, creating a Layout nested under another folder with a Layout file will fully replace the layout further up the tree with the one closest to the rendered page. Shouldn't the nested Layout component simply wrap the Page component, and be mounted & rendered while inheriting all the Layout's further up the tree (as the Page component itself does?).

TL:DR; Should the Layout component just simply wrap the Page?

@traviscooper traviscooper added the enhancement ✨ New feature or request label Mar 29, 2024
@brillout
Copy link
Member

What's your use case for wanting cumulative Layouts?

The reason I went for non-cumulative Layouts is because the use case I had in mind is having pages that have different layouts, for example the landing page typically has a difference layout than an admin panel.

Closing but let's continue the discussion. Let's see if there is a better design to be discovered, and if there is, we can then open a clear roadmap feature request.

(I've seen you started to personally sponsor Vike, thank you 💚)

@brillout brillout closed this as not planned Won't fix, can't repro, duplicate, stale Mar 30, 2024
@traviscooper
Copy link
Sponsor Author

My thinking was to replicate what NextJS does with Layouts & nesting. I initially wasn't convinced with how they do it, but have since come around to the benefits of it.

After developing a lot with NextJS app pages, I think in practice you'd branch these two concerns (for example a landing page and admin panel) at the very top, and allow all sub-pages to inherit layouts as you nest further down/into the page.

I appreciate the feedback and background! I want to enable NextJS app router support by using Vike, but before I implemented it in my projects, I wanted to see if I missed something with the existing implementation.

@brillout
Copy link
Member

brillout commented Apr 5, 2024

Yes, Next.js's support for nested layouts is quite neat. It's very much on the radar and I've a couple of neat ideas around this. (You can see some of it at #1459 but there is more to it I didn't write down yet.)

In the meantime I guess the workaround depicated at https://vike.dev/Layout#nested-layouts is an acceptable (albeit clunky) solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants