fix: allow store as initial value for props in ssr (#12885)

pull/12889/head
Paolo Ricciuti 1 year ago committed by GitHub
parent c09decec44
commit 33a159cd61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: allow store as initial value for props in ssr

@ -39,7 +39,9 @@ export function VariableDeclaration(node, context) {
}
}
});
declarations.push(b.declarator(id, b.id('$$props')));
declarations.push(
b.declarator(/** @type {Pattern} */ (context.visit(id)), b.id('$$props'))
);
continue;
}

@ -0,0 +1,3 @@
import { test } from '../../test';
export default test({});

@ -0,0 +1,7 @@
<script lang="ts">
import { writable } from 'svelte/store';
const page = writable(1);
const { value = $page } = $props();
</script>
{value}
Loading…
Cancel
Save