-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
"magic" layout for resetting #5311
Comments
Had the same request at a conference from two people. Alternative: bring |
How would this work if people tried to do With |
Named routes are already a very complicated feature. I don't think it's a good idea to introduce more magic to an already commonly misunderstood system. I think the solution lies in better educating folks on this. How about adding the I think the docs are lacking, too. They immediately go off about how named layouts can do a ton of stuff but no common use cases. It's a bit easy to get "lost in the sauce" as one might say. I think putting a tl;dr at the top with some common recipes would go a long way. |
I think from all features that Svelte and SvelteKit offer, layouts are actually the most confusing and complicated feature. So I agree with @furudean . I use it really carefully and a lot of more complicated stuff that someone would typically use layouts for, I do with dynamic content... like:
<script>
import SomeContainer from '$lib/SomeContainer.svelte';
import { page } from '$app/stores';
</script>
{#if $page.url.pathname.startWith('/something')}
<SomeContainer>
<slot />
</SomeContainer>
{:else}
<slot />
{/if} even tho, doing it with named layouts would make more sense.... and it's just because I find this less chaotic, mainly in more complicated layout structures. I think, we need to redesign layouts (again),... and I got idea of having <script context="module">
export const layouts = {
a: {
b: {
c: {}
}
}
};
</script> and it would render content of that page in layout c that would be in layout b that would be in layout a. Or something like this. (actually that export const layouts is just first idea, it would probably look different, but somehow we would define all layouts like this) |
#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>
Describe the problem
Ever since named layouts it's no longer possible to do
__layout.reset.svelte
.A workaround is to define a top level
__layout-reset.svelte
with just an empty slot, then apply this reset as a named slot:__layout@reset.svelte
Describe the proposed solution
Have
reset
be a magic named layout that does exactly the same without having to define this file.Of course this would break for people that use the reset with something else but an empty slot, maybe SvelteKit can check if it is defined and if not fall back to an empty slot ?
Alternatives considered
No response
Importance
nice to have
Additional Information
No response
The text was updated successfully, but these errors were encountered: