alternative fix for #1575 - return to 2.8 behaviour

pull/1597/head
Rich Harris 7 years ago
parent 0dcc0f2062
commit e17f3fe328

@ -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');

@ -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;

@ -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 = {

Loading…
Cancel
Save