diff --git a/.changeset/modern-clowns-bet.md b/.changeset/modern-clowns-bet.md
new file mode 100644
index 000000000000..cb9a62d74042
--- /dev/null
+++ b/.changeset/modern-clowns-bet.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+Cloned page.params in Pyramid component for Svelte 5+ to prevent async updates from clearing them.
diff --git a/packages/kit/src/core/sync/write_root.js b/packages/kit/src/core/sync/write_root.js
index eb9c61885c9c..90e90d08a8ab 100644
--- a/packages/kit/src/core/sync/write_root.js
+++ b/packages/kit/src/core/sync/write_root.js
@@ -25,7 +25,7 @@ export function write_root(manifest_data, output) {
${
isSvelte5Plus()
? `
- `
+ `
: ``
}`;
@@ -36,7 +36,7 @@ export function write_root(manifest_data, output) {
isSvelte5Plus()
? dedent`{@const Pyramid_${l} = constructors[${l}]}
-
+
${pyramid}
`
: dedent`
@@ -50,7 +50,7 @@ export function write_root(manifest_data, output) {
? dedent`
{@const Pyramid_${l} = constructors[${l}]}
-
+
`
: dedent``
}
diff --git a/packages/kit/test/apps/basics/src/routes/params-prop-async/+layout.svelte b/packages/kit/test/apps/basics/src/routes/params-prop-async/+layout.svelte
new file mode 100644
index 000000000000..3ea59f15a9b2
--- /dev/null
+++ b/packages/kit/test/apps/basics/src/routes/params-prop-async/+layout.svelte
@@ -0,0 +1,8 @@
+
+
+123
+456
+
+{@render children()}
diff --git a/packages/kit/test/apps/basics/src/routes/params-prop-async/+page.svelte b/packages/kit/test/apps/basics/src/routes/params-prop-async/+page.svelte
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/packages/kit/test/apps/basics/src/routes/params-prop-async/[x]/+page.svelte b/packages/kit/test/apps/basics/src/routes/params-prop-async/[x]/+page.svelte
new file mode 100644
index 000000000000..883648964a42
--- /dev/null
+++ b/packages/kit/test/apps/basics/src/routes/params-prop-async/[x]/+page.svelte
@@ -0,0 +1,7 @@
+
+
+x: {params.x}
diff --git a/packages/kit/test/apps/basics/test/test.js b/packages/kit/test/apps/basics/test/test.js
index 2518529e27d5..dea657ca4865 100644
--- a/packages/kit/test/apps/basics/test/test.js
+++ b/packages/kit/test/apps/basics/test/test.js
@@ -2039,6 +2039,27 @@ test.describe('params prop', () => {
});
});
+test.describe('params prop async', () => {
+ test('params prop is passed to the page and persists after async updates', async ({
+ page,
+ clicknav
+ }) => {
+ await page.goto('/params-prop-async');
+
+ await page.hover('[href="/params-prop-async/123"]');
+ await page.waitForTimeout(100);
+ await clicknav('[href="/params-prop-async/123"]');
+ await page.waitForTimeout(100);
+ await expect(page.locator('p')).toHaveText('x: 123');
+
+ await page.hover('[href="/params-prop-async/456"]');
+ await page.waitForTimeout(100);
+ await clicknav('[href="/params-prop-async/456"]');
+ await page.waitForTimeout(100);
+ await expect(page.locator('p')).toHaveText('x: 456');
+ });
+});
+
test.describe('service worker option', () => {
test('pass the options to the service worker', async ({ page }) => {
await page.goto('/');