From 661bbe2c2461f03fbcb7fafe7bba8e32daa002ec Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 17 Jul 2018 14:21:00 -0400 Subject: [PATCH] dont generate nonsensical code --- src/compile/nodes/Component.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/compile/nodes/Component.ts b/src/compile/nodes/Component.ts index a659f5f5f3..f65d8be4f6 100644 --- a/src/compile/nodes/Component.ts +++ b/src/compile/nodes/Component.ts @@ -431,12 +431,11 @@ export default class Component extends Node { ${this.ref && `#component.refs.${this.ref} = ${name};`} } else { ${name} = null; - } - - ${this.ref && deindent` - else if (#component.refs.${this.ref} === ${name}) { + ${this.ref && deindent` + if (#component.refs.${this.ref} === ${name}) { #component.refs.${this.ref} = null; }`} + } } `);