Skip to content

Commit

Permalink
fix(module: tree): fix remove and clearChildren missing origin (NG-ZO…
Browse files Browse the repository at this point in the history
  • Loading branch information
simplejason authored and Ricbet committed Apr 9, 2020
1 parent 8779388 commit 1630b14
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions components/tree/nz-tree-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export class NzTreeNode {
this.treeService.afterRemove(n, false);
});
this.getChildren().splice(0, this.getChildren().length);
this.origin.children = [];
// refresh checked state
this.treeService.calcCheckedKeys(this.treeService.checkedNodeList.map(v => v.key), this.treeService.rootNodes, this.treeService.isCheckStrictly);
if (this.component) {
Expand All @@ -205,6 +206,7 @@ export class NzTreeNode {
if (this.getParentNode()) {
const index = this.getParentNode().getChildren().findIndex(n => n.key === this.key);
this.getParentNode().getChildren().splice(index, 1);
this.getParentNode().origin.children.splice(index, 1);
this.treeService.afterRemove(this);
if (this.component) {
this.component.markForCheck();
Expand Down

0 comments on commit 1630b14

Please sign in to comment.