From 96537a70572d80556a78fa1887c10aa4eb165408 Mon Sep 17 00:00:00 2001 From: pushkin Date: Sun, 5 Apr 2020 23:15:11 +0200 Subject: [PATCH] Insure if_block dependency is dirty to update Fixes #4630, summary of #4620, #4064, #3685, #3410 and #3202. prior to this change, a component would simply cancel the outro of its `if_block` for any update happening between `outrostart` and `outroend` I tested the REPL provided on each issue and they're all fixed, all but #4064 that also has another bug I'll be looking into --- .../compile/render_dom/wrappers/IfBlock.ts | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/compiler/compile/render_dom/wrappers/IfBlock.ts b/src/compiler/compile/render_dom/wrappers/IfBlock.ts index 207e1e349e..c1ff2024f3 100644 --- a/src/compiler/compile/render_dom/wrappers/IfBlock.ts +++ b/src/compiler/compile/render_dom/wrappers/IfBlock.ts @@ -520,25 +520,14 @@ export default class IfBlockWrapper extends Wrapper { if (branch.dependencies.length > 0) { const update_mount_node = this.get_update_mount_node(anchor); - const enter = dynamic - ? b` - if (${name}) { - ${name}.p(#ctx, #dirty); - ${has_transitions && b`@transition_in(${name}, 1);`} - } else { - ${name} = ${branch.block.name}(#ctx); - ${name}.c(); - ${has_transitions && b`@transition_in(${name}, 1);`} - ${name}.m(${update_mount_node}, ${anchor}); - } - ` - : b` + const enter = b` if (!${name}) { ${name} = ${branch.block.name}(#ctx); ${name}.c(); ${has_transitions && b`@transition_in(${name}, 1);`} ${name}.m(${update_mount_node}, ${anchor}); - } else { + } else if (${block.renderer.dirty(branch.dependencies)}) { + ${dynamic && b`${name}.p(#ctx, #dirty);`} ${has_transitions && b`@transition_in(${name}, 1);`} } `;