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

Reset layout level for X levels in nested layouts #2647

Closed
Kapsonfire-DE opened this issue Oct 20, 2021 · 0 comments · Fixed by #4388
Closed

Reset layout level for X levels in nested layouts #2647

Kapsonfire-DE opened this issue Oct 20, 2021 · 0 comments · Fixed by #4388
Labels
p3-edge-case SvelteKit cannot be used in an uncommon way router

Comments

@Kapsonfire-DE
Copy link
Contributor

Kapsonfire-DE commented Oct 20, 2021

Describe the problem

Having following structure

routes
routes/__layout.svelte
routes/admin/__layout.svelte
routes/admin/spec/__layout.reset.svelte
routes/admin/spec/test.svelte

In test.svelte i dont want the __layout from /routes/admin... so I reset.. but is still want to inherit routes/__layout.svelte
i already imported it and it shows up many things of the original
__layout.svelte but some parts are missing because the load function isnt used this way

Describe the proposed solution

Adding the option to reset layout only by X levels with new file format

__layout.reset.svelte -> reset full inheritance of nested layouts
__layout.reset.1.svelte -> reset layout of only 1 level
__layout.reset.2.svelte -> reset layout of only 2 level

and so on

Alternatives considered

<script lang="ts" context="module">
    import { load as loadOrigin } from "../../../__layout.svelte";
    export async function load(arg) {
        let originLoadRet = await loadOrigin(arg);

        return {
            props:  {
                originLoadRet
            }
        }
    }

</script>
<script lang="ts">
    export let originLoadRet : any;
    import LayoutOrigin from "../../../__layout.svelte";
</script>


<LayoutOrigin {...originLoadRet.props}>
    <slot></slot>
</LayoutOrigin>

Importance

would make my life easier

Additional Information

If the reset level is higher than the totally nested layouts a warning is given and it acts as full reset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-edge-case SvelteKit cannot be used in an uncommon way router
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants