diff --git a/src/compile/nodes/EachBlock.ts b/src/compile/nodes/EachBlock.ts index bb726982dfdb..2a62249c6326 100644 --- a/src/compile/nodes/EachBlock.ts +++ b/src/compile/nodes/EachBlock.ts @@ -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); diff --git a/test/runtime/samples/transition-js-nested-each-keyed-2/Widget.html b/test/runtime/samples/transition-js-nested-each-keyed-2/Widget.html new file mode 100644 index 000000000000..9b57a5905cb9 --- /dev/null +++ b/test/runtime/samples/transition-js-nested-each-keyed-2/Widget.html @@ -0,0 +1,3 @@ +{#each things as thing (thing)} +
+{/each} diff --git a/test/runtime/samples/transition-js-nested-each-keyed-2/_config.js b/test/runtime/samples/transition-js-nested-each-keyed-2/_config.js new file mode 100644 index 000000000000..fda0786b3f8d --- /dev/null +++ b/test/runtime/samples/transition-js-nested-each-keyed-2/_config.js @@ -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, ''); + }, +}; diff --git a/test/runtime/samples/transition-js-nested-each-keyed-2/main.html b/test/runtime/samples/transition-js-nested-each-keyed-2/main.html new file mode 100644 index 000000000000..d931f220a4aa --- /dev/null +++ b/test/runtime/samples/transition-js-nested-each-keyed-2/main.html @@ -0,0 +1,9 @@ +{#if x} +