-
-
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
__error not correctly displayed when default layout inherits from a named layout #4940
Comments
I am having this issue as well |
Duplicate of #4582 |
I just run into this as well. It's not a duplicate of #4582. That's requesting support for inheriting from named layouts in the error layout. This is a bug where the default layout is incorrectly inherited from in the error layout if that default layout inherits from a named layout. |
To be a little more specific: If a |
The error appears to be here:
respond_with_error function is only including the main layout and the error layout. I haven't been able to sort through what the regular respond function is doing differently that it includes all of the appropriate Loaded objects.
|
I believe this can be partly worked around, at least in the 404 case, by adding a dummy <!-- src/routes/[...catchAll].svelte -->
<script context="module">
export function load({ url }) {
return { status: 404, error: "Not found: " + url.pathname };
}
</script> |
This sounds like another instance of the root fallback behavior where the first layout is used to render the error page in - which in this case is wrong, because it depends on another one. I'm more and more of the opinion that we need to have a a fallback root layout regardless of other provided roots layouts, and in this case we need to apply some logic to not only know the root layout but also its dependencies. |
#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 bug
Let us assume such a file structure
__layout-init.svelte
used to load initialization content such as shared styles and external js files for whole site, login page use just__layout-init.svelte
cuz it's a additional page that don't need__layout@init.svelte
, everything is ok so far, but, the__error.svelte
just inherit from__layout@init.svelte
and lost__layout-init.svelte
that means error page can't load initialization content ( which should inherit from ->__layout@init.svelte
->__layout-init.svelte
)I think it's a bug or design to?
Reproduction
here is online demo
Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
No response
The text was updated successfully, but these errors were encountered: