Skip to content

Commit

Permalink
fix: tree can't update root node (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
mortalYoung authored Aug 26, 2021
1 parent 133153f commit 45fe3f6
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/services/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,20 +149,8 @@ export class TreeViewUtil<T extends BaseProps> implements ITreeInterface<T> {
const index = this.getIndex(id);
const node = this.get(id);
if (index) {
const parentIndex = this.getIndex(index.parent!);
const parentNode = this.get(index.parent!);
if (parentNode && parentIndex) {
parentNode[this.childNodeName].splice(
parentNode[this.childNodeName].indexOf(node),
1,
{
...node,
...extra,
}
);
this.updateChildren(parentIndex[this.childNodeName]);
return node;
}
Object.assign(node, extra);
return node;
}
return null;
}
Expand Down

0 comments on commit 45fe3f6

Please sign in to comment.