mirror of https://github.com/sveltejs/svelte
fix: hydrate controlled each blocks correctly (#10259)
Controlled each block didn't handle hydration of fallback correctly fixes #10231pull/10266/head
parent
434a58711f
commit
6b0bd8b23a
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"svelte": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: hydrate controlled each blocks correctly
|
@ -1,3 +1,3 @@
|
|||||||
<!--ssr:0--><h1>Hello, world</h1>
|
<!--ssr:0--><h1>Hello, world</h1>
|
||||||
<!--ssr:1--><p>weird</p><!--ssr:1-->
|
<!--ssr:1--><p>foo</p><!--ssr:1-->
|
||||||
<!--ssr:0-->
|
<div><!--ssr:2--><p>foo</p><!--ssr:2--></div><!--ssr:0-->
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
<script>
|
<script>
|
||||||
export let name = "world";
|
export let name = "world";
|
||||||
export let array = [];
|
export let foo = 'foo';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>Hello, {name}</h1>
|
<h1>Hello, {name}</h1>
|
||||||
{#each array as elem}
|
{#each [] as _}nope{:else}
|
||||||
<p>
|
<p>{foo}</p>
|
||||||
item
|
|
||||||
</p>
|
|
||||||
{:else}
|
|
||||||
<p>
|
|
||||||
weird
|
|
||||||
</p>
|
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
|
<!-- a single each block inside an element is "controlled", which is an optimization which we test here, too -->
|
||||||
|
<div>
|
||||||
|
{#each [] as _}nope{:else}
|
||||||
|
<p>{foo}</p>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
Loading…
Reference in new issue