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:1--><p>weird</p><!--ssr:1-->
|
||||
<!--ssr:0-->
|
||||
<!--ssr:1--><p>foo</p><!--ssr:1-->
|
||||
<div><!--ssr:2--><p>foo</p><!--ssr:2--></div><!--ssr:0-->
|
||||
|
@ -1,15 +1,16 @@
|
||||
<script>
|
||||
export let name = "world";
|
||||
export let array = [];
|
||||
export let foo = 'foo';
|
||||
</script>
|
||||
|
||||
<h1>Hello, {name}</h1>
|
||||
{#each array as elem}
|
||||
<p>
|
||||
item
|
||||
</p>
|
||||
{:else}
|
||||
<p>
|
||||
weird
|
||||
</p>
|
||||
{#each [] as _}nope{:else}
|
||||
<p>{foo}</p>
|
||||
{/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