You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently __layout.reset.svelte files undo all the layouts that have been applied from the root level. This behaviour is undesirable when we only want to reset the immediate parent layout and leave the remaining ones.
Another thing that makes it undesirable, importing global stylesheets in the root layout is a common pattern from what I've seen and undoing the root layout means having to do those imports all over again in the reset file.
Describe the proposed solution
My first thought was something in the filename of the resets like __layout.reset.1.svelte.
Seeing #4103 and #2694 makes me wonder what if we ditch the __layout.reset.svelte file altogether and instead allow page level components (incl __layout.svelte files) to do export const reset like with prerender and router except that reset would be number instead of a boolean.
If page2 exports reset = 1, then it'd only reset nested/__layout.svelte
If it exports reset = 2, then it'd reset both nested/__layout.svelte and routes/__layout.svelte
Example 2
If nested/__layout.svelte exports reset = 1, then it'd reset its parent layout, routes/__layout.svelte
And if it didn't export reset at all, then it'd just stack like it currently does.
Example 3?
If the current behavior of resetting all the way to the top is desired in some cases, then exporting reset = 0 could be treated as a special value to make that easier (this can be scrapped if it's thought to be ambiguous/confusing)
Alternatives considered
N/A
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered:
I don't agree with the proposed solution, but I agree with the general problem: layouts are a little too strongly coupled with the directory structure right now, which is in turn strongly coupled with routing. It's great that layouts just work in a simple way out of the box, but I don't think there's enough flexibility right now. Ideally I should be able to easily configure an arbitrary route to use an arbitrary layout.
Describe the problem
Currently
__layout.reset.svelte
files undo all the layouts that have been applied from the root level. This behaviour is undesirable when we only want to reset the immediate parent layout and leave the remaining ones.Another thing that makes it undesirable, importing global stylesheets in the root layout is a common pattern from what I've seen and undoing the root layout means having to do those imports all over again in the reset file.
Describe the proposed solution
My first thought was something in the filename of the resets like
__layout.reset.1.svelte
.Seeing #4103 and #2694 makes me wonder what if we ditch the __layout.reset.svelte file altogether and instead allow page level components (incl
__layout.svelte
files) to doexport const reset
like withprerender
androuter
except thatreset
would be number instead of a boolean.Say we have a file structure like this.
Example 1
If page2 exports
reset = 1
, then it'd only resetnested/__layout.svelte
If it exports
reset = 2
, then it'd reset bothnested/__layout.svelte
androutes/__layout.svelte
Example 2
If
nested/__layout.svelte
exportsreset = 1
, then it'd reset its parent layout,routes/__layout.svelte
And if it didn't export
reset
at all, then it'd just stack like it currently does.Example 3?
If the current behavior of resetting all the way to the top is desired in some cases, then exporting
reset = 0
could be treated as a special value to make that easier (this can be scrapped if it's thought to be ambiguous/confusing)Alternatives considered
N/A
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: