diff --git a/src/compile/dom/Block.ts b/src/compile/dom/Block.ts index 31a01b6eb3..977486bd8d 100644 --- a/src/compile/dom/Block.ts +++ b/src/compile/dom/Block.ts @@ -169,11 +169,9 @@ export default class Block { toString() { const { dev } = this.compiler.options; - const properties = new CodeBuilder(); if (this.hasIntroMethod || this.hasOutroMethod) { this.addVariable('#current'); - properties.addBlock(`cr(){ return #current; },`); if (!this.builders.mount.isEmpty()) { this.builders.mount.addLine(`#current = true;`); @@ -188,6 +186,8 @@ export default class Block { this.builders.mount.addLine(`${this.autofocus}.focus();`); } + const properties = new CodeBuilder(); + let localKey; if (this.key) { localKey = this.getUniqueName('key'); diff --git a/src/compile/nodes/IfBlock.ts b/src/compile/nodes/IfBlock.ts index 65f1537a27..23ac29166e 100644 --- a/src/compile/nodes/IfBlock.ts +++ b/src/compile/nodes/IfBlock.ts @@ -301,7 +301,7 @@ export default class IfBlock extends Node { const updateMountNode = this.getUpdateMountNode(anchor); const destroyOldBlock = deindent` - if(${name}.cr()) @groupOutros(); + @groupOutros(); ${name}.o(function() { ${if_blocks}[${previous_block_index}].d(1); ${if_blocks}[${previous_block_index}] = null; @@ -423,7 +423,7 @@ export default class IfBlock extends Node { // as that will typically result in glitching const exit = branch.hasOutroMethod ? deindent` - if(${name}.cr()) @groupOutros(); + @groupOutros(); ${name}.o(function() { ${name}.d(1); ${name} = null; diff --git a/src/shared/transitions.js b/src/shared/transitions.js index 87635927c7..1aa430a3b3 100644 --- a/src/shared/transitions.js +++ b/src/shared/transitions.js @@ -72,8 +72,8 @@ export function wrapTransition(component, node, fn, params, intro) { } if (!b) { - program.group = outros; - outros.remaining += 1; + program.group = outros.current; + outros.current.remaining += 1; } if (obj.delay) { @@ -165,14 +165,13 @@ export function wrapTransition(component, node, fn, params, intro) { }; } -export let outros = { - remaining: 0, - callbacks: [] -}; +export let outros = {}; export function groupOutros() { - outros.remaining = 0; - outros.callbacks = []; + outros.current = { + remaining: 0, + callbacks: [] + }; } export var transitionManager = {