-
-
Notifications
You must be signed in to change notification settings - Fork 432
Calling this.error inside preload on a _layout route hangs the site #1506
Comments
I've run into this recently also. I wanted to fetch some data on every route, so I decided to put the Is there any way around this? |
I submitted a PR that breaks the infinite loop. However, there's no way to recover from this situation and render a styled error page, so it will result in an unstyled text response. For the situation described by @saylerb where the layout is loading data for other components you can probably skip loading the data on the error page by checking the page store if it is an error page. |
This should be fixed in 0.28.10. |
How would you do that? I don't see a way to tell from the |
Sorry for the late reply, but you can check for the |
Describe the bug
What the title says. I'm calling a service from a preload method in a _layout page, if the service fails then I'm calling the this.error function. When this happens on a layout page it seems to get stuck in permanent loading in browser, it never finishes loading.
Logs
There's nothing out of the ordinary in the server logs. In the browser the page never gets to load in the first place.
To Reproduce
Create a new sapper project using the template, and add this to a _layout.svelte:
If this is done in any other route, non layout, then it correctly loads and shows the error page.
Expected behavior
Expected to see the error page.
Information about your Sapper Installation:
npx envinfo --system --npmPackages svelte,sapper,rollup,webpack --binaries --browsers
Tested on latest Chrome and Firefox Developer Edition. I don't think this is a browser issue.
Local testing with
npm run dev
npm run export
) or dynamic applicationSeverity
How severe an issue is this bug to you? Is this annoying, blocking some users, blocking an upgrade or blocking your usage of Sapper entirely?
Sapper is currently only being evaluated. Not being able to do proper error handling would be a blocker, maybe there's a workaround or maybe I'm doing something wrong.
The text was updated successfully, but these errors were encountered: