Minimal reproduction for a bug in SvelteKit's experimental
kit.experimental.handleRenderingErrors.
An error() thrown in a remote query that is await-ed inside a component is
a render error. With handleRenderingErrors: true SvelteKit catches it in
the per-route <svelte:boundary> and shows the nearest +error.svelte — correct.
But on a subsequent client-side navigation the failed boundary is never
reset(), so the +error.svelte stays mounted on a now-valid page until a
hard reload. The reactive page store does update (page.status goes back to
200), giving an inconsistent UI.
pnpm install
pnpm dev- Open
/→ "Home". - Click thing/missing (404) → "Error: 404" /
"missing" not found(correct). - Click thing/exists (ok) → BUG: URL is
/thing/existsbut the page still shows "Error: 200" instead of "Thing exists". - A hard reload restores "Thing exists".
Expected: step 3 shows "Thing exists" (boundary resets on navigation).
Actual: the +error.svelte stays until a full reload.
.svelte-kit/generated/root.svelte wraps each route layer in a
<svelte:boundary>. A failed Svelte 5 boundary stays failed until reset() is
called. The client router (@sveltejs/kit/src/runtime/client/client.js) only
clears its own rendering_error tracking var and calls root.$set(...) on each
client navigation — it never calls reset() on the boundary, nor is the
boundary {#key}-ed on the route:
rendering_error = null; // TODO this can break with forks, rethink for SvelteKit 3 where we can assume Svelte 5
root.$set(navigation_result.props);The first load is fine because it goes through initialize(), which creates the
root fresh.