Skip to content

Commit

Permalink
fix(module: tree): fix remove and clearChildren missing origin (#2995)
Browse files Browse the repository at this point in the history
  • Loading branch information
simplejason authored and vthinkxie committed Feb 28, 2019
1 parent dbcf782 commit 41b0e67
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 41b0e67

Please sign in to comment.