diff --git a/src/compile/render-dom/wrappers/EachBlock.ts b/src/compile/render-dom/wrappers/EachBlock.ts index cc9ebed833..419543e018 100644 --- a/src/compile/render-dom/wrappers/EachBlock.ts +++ b/src/compile/render-dom/wrappers/EachBlock.ts @@ -92,9 +92,11 @@ export default class EachBlockWrapper extends Wrapper { this.index_name = this.node.index || renderer.component.get_unique_name(`${this.node.context}_index`); - const fixed_length = node.expression.node.type === 'ArrayExpression' - ? node.expression.node.elements.length - : null; + const fixed_length = + node.expression.node.type === 'ArrayExpression' && + node.expression.node.elements.every(element => element.type !== 'SpreadElement') + ? node.expression.node.elements.length + : null; // hack the sourcemap, so that if data is missing the bug // is easy to find @@ -508,4 +510,4 @@ export default class EachBlockWrapper extends Wrapper { block.builders.destroy.add_block(`@destroy_each(${iterations}, detaching);`); } -} \ No newline at end of file +}