From cacec0c63ab7826321c0d4ab42fc76d564b43db3 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 1 May 2018 21:55:08 -0400 Subject: [PATCH] create key before testing for the existence of key. doh --- src/compile/nodes/EachBlock.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compile/nodes/EachBlock.ts b/src/compile/nodes/EachBlock.ts index 35376c9e2b..d9c93fc036 100644 --- a/src/compile/nodes/EachBlock.ts +++ b/src/compile/nodes/EachBlock.ts @@ -40,16 +40,16 @@ export default class EachBlock extends Node { this.scope.add(context.key.name, this.expression.dependencies); }); + this.key = info.key + ? new Expression(compiler, this, this.scope, info.key) + : null; + if (this.index) { // index can only change if this is a keyed each block const dependencies = this.key ? this.expression.dependencies : []; this.scope.add(this.index, dependencies); } - this.key = info.key - ? new Expression(compiler, this, this.scope, info.key) - : null; - this.children = mapChildren(compiler, this, this.scope, info.children); this.else = info.else