Skip to content

Commit 0c4f599

Browse files
Victoria WeiVictoria Wei
Victoria Wei
authored and
Victoria Wei
committed
This commit fixes #11148
1 parent 08ad2c9 commit 0c4f599

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/demo-app/tree/dynamic-tree-demo/dynamic-database.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,22 @@ export class DynamicDataSource {
100100
}
101101
node.isLoading = true;
102102

103+
let count = 0;
104+
103105
setTimeout(() => {
104106
if (expand) {
105107
const nodes = children.map(name =>
106108
new DynamicFlatNode(name, node.level + 1, this.database.isExpandable(name)));
107109
this.data.splice(index + 1, 0, ...nodes);
108110
} else {
109-
this.data.splice(index + 1, children.length);
111+
for (let i = index + 1; i < this.data.length; i++) {
112+
if (this.data[i].level > node.level) {
113+
count++;
114+
} else {
115+
break;
116+
}
117+
}
118+
this.data.splice(index + 1, count);
110119
}
111120

112121
// notify the change

0 commit comments

Comments
 (0)