diff --git a/src/compiler/compile/render_dom/wrappers/EachBlock.ts b/src/compiler/compile/render_dom/wrappers/EachBlock.ts index 9e4f0689fa..b57ce46b29 100644 --- a/src/compiler/compile/render_dom/wrappers/EachBlock.ts +++ b/src/compiler/compile/render_dom/wrappers/EachBlock.ts @@ -465,7 +465,7 @@ export default class EachBlockWrapper extends Wrapper { `); remove_old_blocks = deindent` @group_outros(); - for (; #i < ${view_length}; #i += 1) ${out}(#i); + for (#i = ${this.vars.each_block_value}.${length}; #i < ${view_length}; #i += 1) ${out}(#i); @check_outros(); `; } else { diff --git a/test/runtime/samples/each-block-component-no-props/Child.svelte b/test/runtime/samples/each-block-component-no-props/Child.svelte new file mode 100644 index 0000000000..86ef4f3319 --- /dev/null +++ b/test/runtime/samples/each-block-component-no-props/Child.svelte @@ -0,0 +1 @@ +

hello

\ No newline at end of file diff --git a/test/runtime/samples/each-block-component-no-props/_config.js b/test/runtime/samples/each-block-component-no-props/_config.js new file mode 100644 index 0000000000..6a2bc67697 --- /dev/null +++ b/test/runtime/samples/each-block-component-no-props/_config.js @@ -0,0 +1,10 @@ +export default { + html: ` +

hello

+ `, + + async test({ assert, component, target }) { + await component.remove(); + assert.htmlEqual(target.innerHTML, ``); + } +}; diff --git a/test/runtime/samples/each-block-component-no-props/main.svelte b/test/runtime/samples/each-block-component-no-props/main.svelte new file mode 100644 index 0000000000..15139fa17b --- /dev/null +++ b/test/runtime/samples/each-block-component-no-props/main.svelte @@ -0,0 +1,13 @@ + + +{#each items as item} + +{/each}