Fixed tree related issues.

This commit is contained in:
Akshay Joshi 2024-09-16 10:09:28 +05:30
parent dd6f6cf1af
commit 53760dbf59
2 changed files with 4 additions and 2 deletions

View File

@ -611,7 +611,9 @@ export class FileTreeX extends React.Component<IFileTreeXProps> {
const scrollXPos = scrollX || 0; const scrollXPos = scrollX || 0;
const scrollYPos = scrollY || this.props.model.state.scrollOffset; const scrollYPos = scrollY || this.props.model.state.scrollOffset;
const div = this.wrapperRef.current.querySelector('div').querySelector('div') as HTMLDivElement; const div = this.wrapperRef.current.querySelector('div').querySelector('div') as HTMLDivElement;
div.scroll(scrollXPos, scrollYPos); if (div) {
div.scroll(scrollXPos, scrollYPos);
}
}; };

View File

@ -477,7 +477,7 @@ export class Tree {
let result = {}; let result = {};
if (identifier === undefined) return; if (identifier === undefined) return;
let item = TreeNode.prototype.isPrototypeOf(identifier) ? identifier : this.findNode(identifier.path); let item = TreeNode.prototype.isPrototypeOf(identifier) ? identifier : this.findNode(identifier.path);
if (item === undefined) return; if (!item) return;
do { do {
const currentNodeData = item.getData(); const currentNodeData = item.getData();
if (currentNodeData._type in this.Nodes && this.Nodes[currentNodeData._type].hasId) { if (currentNodeData._type in this.Nodes && this.Nodes[currentNodeData._type].hasId) {