-
-
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
[fix] render error page without root layout if that failed to load #6155
Conversation
🦋 Changeset detectedLatest commit: 987d94f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
I definitely don't think we should introduce this behaviour — it's effectively non-deterministic. With the new layouts proposal, it would be straightforward to have the fallback error page render inside a blank layout (or a layout that is guaranteed not to error, because it doesn't have an accompanying That leaves the question of what to do if the root layout does error. Provided we've given app developers the tools to avoid that scenario (which #6124 does), then a plain 500 response seems perfectly acceptable during SSR. If it happens on the client, the path of least resistance might be to simply reload the page. |
How is this non-determenistic? If the root layout fails, it's not used - this is equivalent to a blank layout with the difference that the user doesn't have to create a group just to guarantee that his root layout never errors. If you talk about non-determinism on the client due to the try-catch - that could be adjusted so that the same logic as on the server applies: if we detect that the root layout errored, not use it, else use it. |
It's non-deterministic because failures are non-deterministic. As an app author I shouldn't have to design my error page such that it will work both inside and outside the layout depending on factors outside my control |
But how likely is it that you designed your error page that way? It could only fail if it references |
It's very unlikely, and that's the problem! |
It's unlikely that the root layout errors. It's even more unlikely that someone uses things from the root layout in their root error page. It's very likely that someone wants to show something better than blank text if the root layout fails. Therefore everyone who wants that is forced to use a |
Totally agree that there should be something better than blank text, but what that thing is absolutely has to be predictable. There will always be cases where we need to bail completely (even if layout One possible idea: an optional |
People have expressed the desire previously to have a error page break out of the complete layout stack (including the root layout). Can we satisfy both needs by introducing a special |
I think it's better to use the existing primitives. My reaction to 'but then you'll need to put everything inside a
...and that's before we try to answer the design question (what is the
|
closing in favour of #6367 |
Fixes #4815
Fixes #3068
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0