Skip to content

Commit 41b0e67

Browse files
simplejasonvthinkxie
authored andcommitted
fix(module: tree): fix remove and clearChildren missing origin (#2995)
1 parent dbcf782 commit 41b0e67

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

components/tree/nz-tree-node.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ export class NzTreeNode {
194194
this.treeService.afterRemove(n, false);
195195
});
196196
this.getChildren().splice(0, this.getChildren().length);
197+
this.origin.children = [];
197198
// refresh checked state
198199
this.treeService.calcCheckedKeys(this.treeService.checkedNodeList.map(v => v.key), this.treeService.rootNodes, this.treeService.isCheckStrictly);
199200
if (this.component) {
@@ -205,6 +206,7 @@ export class NzTreeNode {
205206
if (this.getParentNode()) {
206207
const index = this.getParentNode().getChildren().findIndex(n => n.key === this.key);
207208
this.getParentNode().getChildren().splice(index, 1);
209+
this.getParentNode().origin.children.splice(index, 1);
208210
this.treeService.afterRemove(this);
209211
if (this.component) {
210212
this.component.markForCheck();

0 commit comments

Comments
 (0)