fix: reapply context after transforming error during SSR (#18099)

Don't have a test for it and no bug report but I stumbled upon this and
I'm very certain not restoring context here is wrong since it means the
failed snippet rendering gets the wrong context.

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
pull/18184/head
Simon H 2 months ago committed by GitHub
parent 5e054574db
commit aeb6bd088b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: reapply context after transforming error during SSR

@ -715,7 +715,12 @@ export class Renderer {
const { context, failed, transformError } = item.#boundary;
set_ssr_context(context);
let transformed = await transformError(error);
let promise = transformError(error);
set_ssr_context(null);
let transformed = await promise;
set_ssr_context(context);
// Render the failed snippet instead of the partial children content
const failed_renderer = new Renderer(item.global, item);

Loading…
Cancel
Save