From 5848cc32041b6d440f4191580efe09fb824ab7b0 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 13 May 2018 20:46:00 -0400 Subject: [PATCH] use unique name for rects --- src/compile/nodes/EachBlock.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compile/nodes/EachBlock.ts b/src/compile/nodes/EachBlock.ts index bfd5d92e9f..358291e332 100644 --- a/src/compile/nodes/EachBlock.ts +++ b/src/compile/nodes/EachBlock.ts @@ -314,13 +314,15 @@ export default class EachBlock extends Node { const dynamic = this.block.hasUpdateMethod; + const rects = block.getUniqueName('rects'); + block.builders.update.addBlock(deindent` const ${this.each_block_value} = ${snippet}; ${this.block.hasOutroMethod && `@transitionManager.groupOutros();`} - ${this.block.animation && `const rects = @measure(${blocks});`} + ${this.block.animation && `const ${rects} = @measure(${blocks});`} ${blocks} = @updateKeyedEach(${blocks}, #component, changed, ${get_key}, ${dynamic ? '1' : '0'}, ctx, ${this.each_block_value}, ${lookup}, ${updateMountNode}, ${String(this.block.hasOutroMethod)}, ${create_each_block}, "${mountOrIntro}", ${anchor}, ${this.get_each_context}); - ${this.block.animation && `@animate(${blocks}, rects, %animations-${this.children[0].animation.name}, {});`} + ${this.block.animation && `@animate(${blocks}, ${rects}, %animations-${this.children[0].animation.name}, {});`} `); if (this.compiler.options.nestedTransitions) {