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

Allow layout reset without __layout.reset.svelte #4103

Closed
ebeloded opened this issue Feb 24, 2022 · 4 comments · Fixed by #4388
Closed

Allow layout reset without __layout.reset.svelte #4103

ebeloded opened this issue Feb 24, 2022 · 4 comments · Fixed by #4388
Labels
feature / enhancement New feature or request p2-nice-to-have SvelteKit cannot be used by a small number of people, quality of life improvements, etc. router

Comments

@ebeloded
Copy link

Describe the problem

Let's say we need /login to not inherit root layout from __layout.svelte. To do this one needs to create login folder with __layout.reset.svelte and index.svelte:

login/
  __layout.reset.svelte
  index.svelte

This feels like a lot of noise for a one page layout reset. It gets more frustrating when there are many such pages.

Describe the proposed solution

I propose to allow .reset.svelte to reset the layout without the need of __layout.reset.svelte. The /login path described above would be implemented simply like this:

login.reset.svelte

Alternatives considered

One can put together all pages needing a reset in folder with layout reset:

user
  __layout.reset.svelte
  login.svelte
  signup.svelte

This means that the paths will be /user/login and /user/signup, not the desired /login and /signup

Importance

would make my life easier

Additional Information

No response

@rmunn
Copy link
Contributor

rmunn commented Feb 25, 2022

Related to #3832

@rmunn rmunn added feature / enhancement New feature or request p2-nice-to-have SvelteKit cannot be used by a small number of people, quality of life improvements, etc. pkg:svelte-package Issues related to svelte-package router and removed pkg:svelte-package Issues related to svelte-package labels Feb 25, 2022
@rmunn
Copy link
Contributor

rmunn commented Feb 25, 2022

Note that __layout.reset.svelte is also itself a layout component. Were you proposing that login.reset.svelte would be a layout component that applies just to the login.svelte component, so you'd write two files login.reset.svelte and login.svelte? Or were you proposing that login.reset.svelte would be the component itself, i.e. there's just one login.reset.svelte file and there's no login.svelte file?

I'd assume it's the latter (if you have a login.reset.svelte file, it's treated as if it's named login.svelte but the layouts aren't applied to it, so it can contain its own layout), but I figured it would be best to clarify.

Also worth considering would be whether any shadow endpoints would need to be renamed to login.reset.ts (or .js) or whether they would keep the name login.ts. I could see arguments either way, though personally I'd be inclined to say that shadow endpoints shouldn't have a .reset in their names, because layouts are a client-side thing and shadow endpoints should be server-side. But then you don't have matching filenames any more, which is a downside. Hmmm...

@mustofa-id
Copy link

or maybe:

<script context="module">
   export const layout = false
</script>

@PeterFelis
Copy link

Error: __layout.reset has been removed in favour of named layouts: https://kit.svelte.dev/docs/layouts#named-layouts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature / enhancement New feature or request p2-nice-to-have SvelteKit cannot be used by a small number of people, quality of life improvements, etc. router
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants