kit: Nested layouts are rendering inside parent layouts for error pages

Describe the bug

I have a __layout.svelte (1) in the root of route directory. I have another __layout.svelte (2) more specific in a internal route. So, when I click in a link to a route that not exists yet, the error default error page is renderized in a blank page sometimes, or in the <slot> of __layout.svelte (2) in another times. But, if after that I click in a link to a valid route, the new page is renderized in a new <slot>, as if it were being rendered in the slot (1) , but still maintaining the rendering of slot (2), rendering twice .

Logs

Don’t have server logs for that. There is no significant log in console.

To Reproduce

image image image

  "devDependencies": {
    "@sveltejs/adapter-node": "^1.0.0-next.20",
    "@sveltejs/kit": "next",
    "eslint": "^7.27.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-svelte3": "^3.2.0",
    "prettier": "~2.3.0",
    "prettier-plugin-svelte": "^2.3.0",
    "svelte": "^3.38.2",
    "svelte-windicss-preprocess": "^4.0.7",
    "windicss": "^3.0.12"
  },

Expected behavior I click in a link. The page not exist. The error page is renderized. I click in a new link, to a page that exists. The page is new renderized.

Information about your SvelteKit Installation:

Diagnostics
System:
    OS: Linux 5.8 Linux Mint 20.1 (Ulyssa)
    CPU: (4) x64 Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz
    Memory: 12.14 GB / 23.38 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 16.2.0 - ~/.nvm/versions/node/v16.2.0/bin/node
    npm: 7.13.0 - ~/.nvm/versions/node/v16.2.0/bin/npm
  Browsers:
    Chrome: 91.0.4472.77
    Chromium: 90.0.4430.212
    Firefox: 88.0.1
  npmPackages:
    @sveltejs/kit: next => 1.0.0-next.107 
    svelte: ^3.38.2 => 3.38.2 
  • Your browser Firefox 88.0.1 (64-bits) (For Linux Mint 20.1)

  • Your adapter (e.g. Node, static, Vercel, Begin, etc…) Node

Severity How severe an issue is this bug to you? Is this annoying, blocking some users, blocking an upgrade or blocking your usage of SvelteKit entirely? Blocking your usage of SvelteKit entirely. Only if the client refresh the page, the problem is solved.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

The current behaviour of rendering root __error page for 404s (instead of nested __error if present) seems to be intended.

But why? I am having similar issues and it is quite annoying

If it’s not possible to reproduce, then can this issue be closed?

OK. I close. If it happens again, I can open a new issue by referencing this one. Thanks.

Nested __error.svelte pages are ignored for 404s, but correctly displayed for actual errors.