fix: head duplication when binding is present (#9124)

fixes #7879
fixes #4982
pull/9157/head
gtmnayan 1 year ago committed by GitHub
parent 2691e19b6b
commit d5839ef194
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: head duplication when binding is present

@ -144,9 +144,13 @@ export default function ssr(component, options) {
? b`
let $$settled;
let $$rendered;
let #previous_head = $$result.head;
do {
$$settled = true;
// $$result.head is mutated by the literal expression
// need to reset it if we're looping back to prevent duplication
$$result.head = #previous_head;
${reactive_declarations}

@ -0,0 +1,2 @@
<link rel="canonical" href="/test">
<meta name="description" content="test">

@ -0,0 +1,11 @@
<script>
import Foo from './Foo.svelte';
let bar;
</script>
<svelte:head>
<link rel="canonical" href="/test" />
<meta name="description" content="test" />
</svelte:head>
<Foo bind:bar />
Loading…
Cancel
Save