Skip to content

Commit 47da7d1

Browse files
authoredMar 30, 2018
Merge pull request #1295 from sveltejs/each-block-keyed-empty
handle empty each blocks
2 parents 6e5523c + 50ed925 commit 47da7d1

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed
 

‎src/generators/nodes/EachBlock.ts

+2
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ export default class EachBlock extends Node {
109109
parentNode: string,
110110
parentNodes: string
111111
) {
112+
if (this.children.length === 0) return;
113+
112114
const { generator } = this;
113115

114116
const each = this.var;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
data: {
3+
x: [{ z: 1 }, { z: 2 }],
4+
},
5+
6+
html: ``
7+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{#each x as y @z}}{{/each}}

0 commit comments

Comments
 (0)