From 606946209fe49b84804c7bbe9189e7f99e7ddc2f Mon Sep 17 00:00:00 2001 From: J-IN Date: Fri, 6 Sep 2019 10:37:18 +0200 Subject: [PATCH] fix: if/else case with no dependencies --- src/compiler/compile/render_dom/wrappers/IfBlock.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/compile/render_dom/wrappers/IfBlock.ts b/src/compiler/compile/render_dom/wrappers/IfBlock.ts index 3c2899f355..76e982cde1 100644 --- a/src/compiler/compile/render_dom/wrappers/IfBlock.ts +++ b/src/compiler/compile/render_dom/wrappers/IfBlock.ts @@ -243,7 +243,7 @@ export default class IfBlockWrapper extends Wrapper { function ${select_block_type}(changed, ctx) { ${this.branches.map(({ dependencies, condition, snippet, block }) => condition ? deindent` - ${snippet && `if ((${condition} == null) || ${dependencies.map(n => `changed.${n}`).join(' || ')}) ${condition} = !!(${snippet})`} + ${snippet && `if ((${condition} == null) || ${dependencies.length > 0 ? dependencies.map(n => `changed.${n}`).join(' || ') : false}) ${condition} = !!(${snippet})`} if (${condition}) return ${block.name};` : `return ${block.name};`)} }