diff --git a/src/generators/nodes/EachBlock.ts b/src/generators/nodes/EachBlock.ts index 1eb1d8cb7a..388474bb31 100644 --- a/src/generators/nodes/EachBlock.ts +++ b/src/generators/nodes/EachBlock.ts @@ -296,7 +296,7 @@ export default class EachBlock extends Node { block.builders.update.addBlock(deindent` var ${each_block_value} = ${snippet}; - ${blocks} = @updateKeyedEach(${blocks}, #component, changed, "${this.key}", ${dynamic}, ${each_block_value}, ${lookup}, ${updateMountNode}, ${String(this.block.hasOutroMethod)}, ${create_each_block}, "${mountOrIntro}", function(#i) { + ${blocks} = @updateKeyedEach(${blocks}, #component, changed, "${this.key}", ${dynamic ? '1' : '0'}, ${each_block_value}, ${lookup}, ${updateMountNode}, ${String(this.block.hasOutroMethod)}, ${create_each_block}, "${mountOrIntro}", function(#i) { return @assign(@assign({}, state), { ${this.contextProps.join(',\n')} }); diff --git a/test/runtime/samples/each-block-keyed-static/_config.js b/test/runtime/samples/each-block-keyed-static/_config.js new file mode 100644 index 0000000000..7166854cd6 --- /dev/null +++ b/test/runtime/samples/each-block-keyed-static/_config.js @@ -0,0 +1,10 @@ +export default { + data: { + x: [{ z: 1 }, { z: 2 }], + }, + + html: ` +

does not change

+

does not change

+ ` +}; diff --git a/test/runtime/samples/each-block-keyed-static/main.html b/test/runtime/samples/each-block-keyed-static/main.html new file mode 100644 index 0000000000..d9180cba65 --- /dev/null +++ b/test/runtime/samples/each-block-keyed-static/main.html @@ -0,0 +1,3 @@ +{{#each x as y @z}} +

does not change

+{{/each}}