Fixes keyed each blocks for outro

Fixes #1706
pull/1700/merge
Jacob Wright 6 years ago committed by Conduitry
parent 2e4b65af5a
commit 67d4d60c3a

@ -331,7 +331,7 @@ export default class EachBlock extends Node {
${this.block.hasAnimation && `for (let #i = 0; #i < ${blocks}.length; #i += 1) ${blocks}[#i].a();`}
`);
if (this.compiler.options.nestedTransitions) {
if (this.block.hasOutros && this.compiler.options.nestedTransitions) {
const countdown = block.getUniqueName('countdown');
block.builders.outro.addBlock(deindent`
const ${countdown} = @callAfter(#outrocallback, ${blocks}.length);

@ -0,0 +1,3 @@
{#each things as thing (thing)}
<div></div>
{/each}

@ -0,0 +1,13 @@
export default {
nestedTransitions: true,
data: {
x: true,
things: ['a', 'b']
},
test(assert, component, target, window, raf) {
component.set({ x: false });
assert.htmlEqual(target.innerHTML, '');
},
};

@ -0,0 +1,9 @@
{#if x}
<Widget :things/>
{/if}
<script>
export default {
components: { Widget: './Widget.html' }
};
</script>
Loading…
Cancel
Save