Skip to content

Commit

Permalink
cancel outro before update
Browse files Browse the repository at this point in the history
  • Loading branch information
pushkine committed Apr 20, 2020
1 parent 31b57f2 commit 486a9ba
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/compile/render_dom/wrappers/IfBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,13 +522,13 @@ export default class IfBlockWrapper extends Wrapper {

const enter = b`
if (${name}) {
${dynamic && b`${name}.p(#ctx, #dirty);`}
${
has_transitions &&
b`if (${block.renderer.dirty(branch.dependencies)}) {
@transition_in(${name}, 1);
}`
}
${dynamic && b`${name}.p(#ctx, #dirty);`}
} else {
${name} = ${branch.block.name}(#ctx);
${name}.c();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default {
async test({ assert, target, window, raf }) {
const button = target.querySelector("button");
const event = new window.MouseEvent("click");
assert.htmlEqual(target.innerHTML, "A");
await button.dispatchEvent(event);
raf.tick(500);
assert.htmlEqual(target.innerHTML, "A");
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<script>
import Component from "./Component.svelte";
function foo(node, params) {
return {
duration: 100,
tick: t => {
node.foo = t;
}
};
}
let isFirst = true;
let animationActive = false;
const toggle = () => {
if (animationActive) {
return;
}
animationActive = true;
Promise.resolve().then(() => {
isFirst = !isFirst;
animationActive = false;
});
};
</script>

<button on:click={toggle}>TOGGLE</button>
{#if !animationActive}
<div out:foo>
{#if isFirst}
<Component {isFirst} />
{:else}
<Component {isFirst} />
{/if}
</div>
{/if}

0 comments on commit 486a9ba

Please sign in to comment.