Minimal reproduction for a SvelteKit bug involving:
kit.experimental.remoteFunctionskit.experimental.handleRenderingErrors+error.svelte UI remaining mounted after client navigationRepository:
@sveltejs/kit: 2.57.0svelte: 5.55.2@sveltejs/vite-plugin-svelte: 7.0.0vite: 8.0.7The 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.svelteThe remote query is defined in src/routes/data.remote.ts and throws:
error(404, "There's no data here");
The project also has:
remoteFunctions: truehandleRenderingErrors: trueconfigured in svelte.config.js.
/Go to error page/dataClick this to see the issue/ renders, but the old error page remains mounted above the home page contentWhen navigating from the failed /data route back to /, the failed error UI should be removed and only the home page should remain visible.
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.
npm install
npm run dev
src/routes/data.remote.tssrc/routes/data/+page.sveltesrc/routes/+error.sveltesrc/routes/+page.sveltesvelte.config.js