diff --git a/products/ASC.Files/Client/src/components/FolderTreeBody/TreeFolders.js b/products/ASC.Files/Client/src/components/FolderTreeBody/TreeFolders.js index dacc8bec23..935a0518b2 100644 --- a/products/ASC.Files/Client/src/components/FolderTreeBody/TreeFolders.js +++ b/products/ASC.Files/Client/src/components/FolderTreeBody/TreeFolders.js @@ -237,14 +237,14 @@ class TreeFolders extends React.Component { if (dragging) value = `${item.id} dragging ${provider}`; if (this.needScroll) { - console.log("this.needScroll", this.needScroll); - if (item.parentId.toString() === parentId.toString()) { - if (index === this.child) { + if (item.parentId.toString() === parentId?.toString()) { + if (index === this.childLength) { this.props.setIsLoadingNodes(false); const selectedNode = document.getElementsByClassName( "rc-tree-node-selected" )[0]; if (selectedNode) { + this.needScroll = false; document .querySelector("#folder-tree-scroll-bar > .scroll-body") .scrollTo(0, selectedNode.offsetTop + index * 36); @@ -343,11 +343,11 @@ class TreeFolders extends React.Component { }; getNewTreeData(treeData, curId, child, pos) { - this.child = null; + this.childLength = null; !this.expand && this.props.setIsLoadingNodes(true); - if (!this.expand && curId.toString() === this.props.parentId.toString()) { + if (!this.expand && curId.toString() === this.props.parentId?.toString()) { this.needScroll = true; - this.child = child.length - 1; + this.childLength = child.length - 1; } this.loop(treeData, child, pos); this.setLeaf(treeData, curId, 10);