Implement new layouts system - #6174
Conversation
🦋 Changeset detectedLatest commit: 7c74aa9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-authored-by: Conduitry <git@chor.date>
|
Hi 😊 When will this be available? I'm asking because I did a bunch of modifications based on the docs, but now I just realized that the doc has been deployed before the package 🥹 And I don't remember how to do the previous named layout method (and no more doc on this) 😅 |
|
@maximedupre I just merged the release PR (#6217) so it should hit npm any minute now |
|
Excellent change love it |
|
This PR broke symlink routes ❌ symlinks break Created issue #6303 with repro EDIT: Doing a little bit of research I found the symlink issue was fixed back in PR #4957 The Fix (commit eb2ab91)
Originally posted by @mrkishi in #4957 (review) |
TODO: Reset layout. Read: <sveltejs/kit#6174>.
TODO: Reset layout. Read: <sveltejs/kit#6174>.
How to migration from named layouts
Named layouts have been removed in favor of
(groups). See the documentation for an introduction: https://kit.svelte.dev/docs/advanced-routing#advanced-layoutsHow to migrate highly depends on your use case:
Use case 1: Rewinding to an earlier layout / "breaking out"
If you used named layouts to rewind the layout inheritance chain to a layout higher up the tree, you can reference the segment directly now:
Use case 2: Rewinding to a blank root layout
If you had
+layout-blank.sveltein your root to reset to a blank layout, you need to adjust your actual root layout to be blank and move that functionality into another layout further below in the tree, either using an if-statement in your root layout or using the(group)feature:Use case 3: Different layouts for routes at the same nesting level
If you used named layouts to specify "these 2 pages get layout X and these other 2 next to them get layout Y", use groups instead.
Before:
After
Use case 4: arbitrary inheritance chains
If you previously used named layouts to enhance other named layouts, which also enhance layouts, to mix and match them, then that's no longer possible this way. In cases like this - which from reading the layout chains probably got confusing anyway - we advice to use composition and/or if-statements instead. The new documentation has a section with an example for this as inspiration.
PR description
#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)
+layout-foo.sveltewrite_typesdictionaryinclient-manifest.jsPlease don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. All changesets should bepatchuntil SvelteKit 1.0