Skip to content

Commit

Permalink
Fixes keyed each blocks for outro
Browse files Browse the repository at this point in the history
Fixes #1706
  • Loading branch information
jacwright authored and Conduitry committed Sep 6, 2018
1 parent 2e4b65a commit 67d4d60
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compile/nodes/EachBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{#each things as thing (thing)}
<div></div>
{/each}
13 changes: 13 additions & 0 deletions test/runtime/samples/transition-js-nested-each-keyed-2/_config.js
Original file line number Diff line number Diff line change
@@ -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, '');
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{#if x}
<Widget :things/>
{/if}

<script>
export default {
components: { Widget: './Widget.html' }
};
</script>

0 comments on commit 67d4d60

Please sign in to comment.