diff --git a/src/compiler/compile/render_dom/wrappers/IfBlock.ts b/src/compiler/compile/render_dom/wrappers/IfBlock.ts index 207e1e349e..4dcbb43a39 100644 --- a/src/compiler/compile/render_dom/wrappers/IfBlock.ts +++ b/src/compiler/compile/render_dom/wrappers/IfBlock.ts @@ -334,7 +334,11 @@ export default class IfBlockWrapper extends Wrapper { `); } } else if (dynamic) { - block.chunks.update.push(b`${name}.p(#ctx, #dirty);`); + if (if_exists_condition) { + block.chunks.update.push(b`if (${if_exists_condition}) ${name}.p(#ctx, #dirty);`); + } else { + block.chunks.update.push(b`${name}.p(#ctx, #dirty);`); + } } if (if_exists_condition) {