Skip to content

Commit 486a9ba

Browse files
committed
cancel outro before update
1 parent 31b57f2 commit 486a9ba

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

src/compiler/compile/render_dom/wrappers/IfBlock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,13 +522,13 @@ export default class IfBlockWrapper extends Wrapper {
522522

523523
const enter = b`
524524
if (${name}) {
525-
${dynamic && b`${name}.p(#ctx, #dirty);`}
526525
${
527526
has_transitions &&
528527
b`if (${block.renderer.dirty(branch.dependencies)}) {
529528
@transition_in(${name}, 1);
530529
}`
531530
}
531+
${dynamic && b`${name}.p(#ctx, #dirty);`}
532532
} else {
533533
${name} = ${branch.block.name}(#ctx);
534534
${name}.c();
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default {
2+
async test({ assert, target, window, raf }) {
3+
const button = target.querySelector("button");
4+
const event = new window.MouseEvent("click");
5+
assert.htmlEqual(target.innerHTML, "A");
6+
await button.dispatchEvent(event);
7+
raf.tick(500);
8+
assert.htmlEqual(target.innerHTML, "A");
9+
},
10+
};
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<script>
2+
import Component from "./Component.svelte";
3+
function foo(node, params) {
4+
return {
5+
duration: 100,
6+
tick: t => {
7+
node.foo = t;
8+
}
9+
};
10+
}
11+
let isFirst = true;
12+
let animationActive = false;
13+
14+
const toggle = () => {
15+
if (animationActive) {
16+
return;
17+
}
18+
19+
animationActive = true;
20+
Promise.resolve().then(() => {
21+
isFirst = !isFirst;
22+
animationActive = false;
23+
});
24+
};
25+
</script>
26+
27+
<button on:click={toggle}>TOGGLE</button>
28+
{#if !animationActive}
29+
<div out:foo>
30+
{#if isFirst}
31+
<Component {isFirst} />
32+
{:else}
33+
<Component {isFirst} />
34+
{/if}
35+
</div>
36+
{/if}

0 commit comments

Comments
 (0)