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

Reuse default +layout.js and +layout.server.js in named layout. #6196

Closed
stalkerg opened this issue Aug 23, 2022 · 3 comments · Fixed by #6174
Closed

Reuse default +layout.js and +layout.server.js in named layout. #6196

stalkerg opened this issue Aug 23, 2022 · 3 comments · Fixed by #6174

Comments

@stalkerg
Copy link
Contributor

Describe the problem

If I want to have a second root layout, just a different "layout" (+layout.svelte) I should copy-paste +layout.js and +layout.server.js.
In old routing, schema duplicate was only inside __layout.js load function. Even if I move load function to a separate file, I will duplicate two extra files for each named layout.

Describe the proposed solution

To reduce boilerplate, the named layout should have a way to reuse the default layout client and server functions.

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

@dummdidumm
Copy link
Member

The layout API will very likely change (see discussion), depending on your use case this will be possible introducing groups. If not, you can create a resuable layout UI component and a reusable load function and use that in both your layouts.

@stalkerg
Copy link
Contributor Author

@dummdidumm, thanks for the link! My fault, I skipped it.

@stalkerg
Copy link
Contributor Author

As I can see, only a few people mention about +layout.js and +layout.server.js this proposal is mostly about +layout.svelte and named layouts.

dummdidumm added a commit that referenced this issue Aug 24, 2022
#6124

Closes #6196 (using (groups) and/or composition)
Closes #5763 (root layout guaranteed to always exist + await parent())
Closes #5311 (+page@.svelte)
Closes #4940 (no longer possible to get into this situation)
Closes #2154 (only a single root layout now)

Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Co-authored-by: Dominik G. <dominik.goepel@gmx.de>
Co-authored-by: Ignatius Bagus <ignatius.mbs@gmail.com>
Co-authored-by: Conduitry <git@chor.date>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants