提交 d23187a9 编写于 作者: J Joao Moreno

object tree model: faster getNode

上级 9658a617
......@@ -198,8 +198,17 @@ export class ObjectTreeModel<T extends NonNullable<any>, TFilterData extends Non
}
getNode(element: T | null = null): ITreeNode<T | null, TFilterData> {
const location = this.getElementLocation(element);
return this.model.getNode(location);
if (element === null) {
return this.model.getNode(this.model.rootRef);
}
const node = this.nodes.get(element);
if (!node) {
throw new Error(`Tree element not found: ${element}`);
}
return node;
}
getNodeLocation(node: ITreeNode<T, TFilterData>): T {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册