@@ -72,7 +72,7 @@ function* treeWalker(refresh) {
72
72
// Walk through the tree until we have no nodes available.
73
73
while (stack .length !== 0 ) {
74
74
const {
75
- node: {children , id , name },
75
+ node: {children = [] , id, name},
76
76
nestingLevel,
77
77
} = stack .pop ();
78
78
@@ -93,13 +93,13 @@ function* treeWalker(refresh) {
93
93
94
94
// Basing on the node openness state we are deciding if we need to render
95
95
// the child nodes (if they exist).
96
- if (node . children .length !== 0 && isOpened) {
96
+ if (children .length !== 0 && isOpened) {
97
97
// Since it is a stack structure, we need to put nodes we want to render
98
98
// first to the end of the stack.
99
- for (let i = node . children .length - 1 ; i >= 0 ; i-- ) {
99
+ for (let i = children .length - 1 ; i >= 0 ; i-- ) {
100
100
stack .push ({
101
101
nestingLevel: nestingLevel + 1 ,
102
- node: node . children [i],
102
+ node: children[i],
103
103
});
104
104
}
105
105
}
@@ -242,7 +242,7 @@ function* treeWalker(refresh) {
242
242
243
243
while (stack .length !== 0 ) {
244
244
const {
245
- node: {children , id , name },
245
+ node: {children = [] , id, name},
246
246
nestingLevel,
247
247
} = stack .pop ();
248
248
@@ -260,11 +260,11 @@ function* treeWalker(refresh) {
260
260
}
261
261
: id;
262
262
263
- if (node . children .length !== 0 && isOpened) {
264
- for (let i = node . children .length - 1 ; i >= 0 ; i-- ) {
263
+ if (children .length !== 0 && isOpened) {
264
+ for (let i = children .length - 1 ; i >= 0 ; i-- ) {
265
265
stack .push ({
266
266
nestingLevel: nestingLevel + 1 ,
267
- node: node . children [i],
267
+ node: children[i],
268
268
});
269
269
}
270
270
}
0 commit comments