only apply key to keyed each block, not its children - fixes #1202

pull/1204/head
Rich Harris 8 years ago
parent 355490878d
commit 7b4c486be9

@ -163,7 +163,7 @@ export default class Block {
}
child(options: BlockOptions) {
return new Block(Object.assign({}, this, options, { parent: this }));
return new Block(Object.assign({}, this, { key: null }, options, { parent: this }));
}
contextualise(expression: Node, context?: string, isEventHandler?: boolean) {

@ -0,0 +1,15 @@
export default {
data: {
items: [
{ id: 1, name: 'one' },
{ id: 2, name: 'two' }
]
},
html: `
<ul>
<li>one</li>
<li>two</li>
</ul>
`
};

@ -0,0 +1,7 @@
<ul>
{{#each items as item @id}}
{{#if item.id}}
<li>{{item.name}}</li>
{{/if}}
{{/each}}
</ul>
Loading…
Cancel
Save