-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
bug: <svelte:boundary> is not working on SSR #15370
Comments
This works as designed, but it's not mentioned in the docs as I realize now |
But IMHO I think the SSR should generate the same result... |
I had the same thought but @trueadm actually gave a good point: if you stream html you can't undo the html you sent |
Yes... but unless I am mistaken, Svelte does not support streaming html... |
There are plans to support it (Dominic knows more than I do)...and I guess if you error out stopping the stream is a non issue no? |
That said I think it would be cool to render the fallback |
I tried quickly and I think it's possible to generate something like that : // store the current position :
const $$pos = $$payload.out.length;
try {
// the content of the <svelte:boundary/>
$$payload.out += `<!---->template`;
} catch ($$err) {
// reset the buffer to the previous position
$$payload.out = $$payload.out.substring(0, $$pos);
// the failed snippet (if any)
let failed = function($$payload) {
$$payload.out += `<!---->error`;
};
failed($$payload);
} But :
|
to catch the errors, add +error.svelte in that particular route, the boundary is for client only. |
Yes but I just want to render the page correctly, without the svelte:boundary part when it fail... Like with a try/catch... |
I think we could allow error boundaries to work, but they'd need to use the |
Describe the bug
The
<svelte:boundary>
do nothing on SSR !On the REPL we can see that code like this :
Will generate this server code :
The template is written, but there no try/catch and the
failed()
snippet is never caller when an error occurs in the template !Actually this will produce an HTTP 500 error :(
I think it should render the
failed()
snippet instead...Reproduction
Click on the links "Bad page" and "Good page" to see that the error is handheld on client-site.
Then, when on the "Bad page", click on the "reload to force SSR" button to regenerate the page via SSR... => HTTP 500
https://www.sveltelab.dev/ravzziihmogkq1a
Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: