When an async page (using experimental.async + SvelteKit remote functions) is
server-rendered and hydrated, the first client-side navigation away from it
fails to remove part of the page's DOM. The orphaned nodes are left inside the
layout's {@render children()} container, stacked above the next page.
build + preview). vite dev does not reproduce it.Masthead) is removed, but the sibling <main> and <PageFooter> that follow it are leaked.pnpm install
pnpm build
pnpm preview # http://localhost:4173
Then:
/news directly (a full page load → SSR + hydration)./news <main> and footer ("No algorithms, no noise…") remain on the
page, stacked above the Settings content.After navigating to /settings, .page-container contains exactly the settings
page: header.page-header, main.content, footer.page-footer.
.page-container contains the leaked /news nodes followed by the settings page:
main.content ← leaked from /news
footer.page-footer ← leaked from /news
header.page-header ← /settings
main.content ← /settings
footer.page-footer ← /settings
All of these are needed to trigger the bug:
compilerOptions.experimental.async: true and kit.experimental.remoteFunctions: true./news/+page.svelte, awaits a remote
get_sources()) renders an async child component (EditorialDesign.svelte, awaits
get_editions() / get_edition()).Masthead → {@render ...}),<main>),PageFooter component./settings) renders the same top-level component
shape (a Masthead-produced <header>, a <main class="content">, and the
same PageFooter component) in the same order.Removing any one of these (e.g. reaching /news via client nav, or making the page
non-async, or not sharing the PageFooter/Masthead shape with the destination)
makes the leak disappear.
svelte 5.55.9@sveltejs/kit 2.61.1@sveltejs/vite-plugin-svelte 6.2.4vite 7.3.3@sveltejs/adapter-node 5.xThis mirrors a real application where every authenticated page is async (each awaits
a remote function) and shares a common Masthead + PageFooter chrome. The first
navigation after landing on the news page leaves a duplicated, dead copy of the
news <main> + footer in the DOM.