sveltekit-error-page-navigation-repro Svelte Themes

Sveltekit Error Page Navigation Repro

Reproduction for sveltekit ssr error boundary rendering. Error boundary persisting on navigation.

SvelteKit Error Page Navigation Repro

Minimal reproduction for a SvelteKit bug involving:

  • kit.experimental.remoteFunctions
  • kit.experimental.handleRenderingErrors
  • a remote query throwing during component render
  • stale +error.svelte UI remaining mounted after client navigation

Repository:

Versions

  • @sveltejs/kit: 2.57.0
  • svelte: 5.55.2
  • @sveltejs/vite-plugin-svelte: 7.0.0
  • vite: 8.0.7

What The Repro Does

The repro has two routes:

  • / renders a normal home page with a link to /data
  • /data awaits a remote query at the top level of +page.svelte

The remote query is defined in src/routes/data.remote.ts and throws:

error(404, "There's no data here");

The project also has:

  • remoteFunctions: true
  • handleRenderingErrors: true

configured in svelte.config.js.

Reproduction Steps

  1. Install dependencies
  2. Start the dev server
  3. Open /
  4. Click Go to error page
  5. Confirm the error page renders for /data
  6. Click Click this to see the issue
  7. Observe that / renders, but the old error page remains mounted above the home page content

Expected Behavior

When navigating from the failed /data route back to /, the failed error UI should be removed and only the home page should remain visible.

Actual Behavior

The previous +error.svelte content remains mounted after the client-side navigation to /, and the home page content renders underneath it.

In this repro, src/routes/+error.svelte reads from $app/state, so the stale error block updates to the new route state and visibly shows Error 200 above the home page. That makes the issue easier to see, but the main problem is that the failed error UI is not torn down on navigation.

Run Locally

npm install
npm run dev

Relevant Files

  • src/routes/data.remote.ts
  • src/routes/data/+page.svelte
  • src/routes/+error.svelte
  • src/routes/+page.svelte
  • svelte.config.js

Top categories

Loading Svelte Themes