From 53760dbf59a4999d85fd2c286401e34a030d92a5 Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Mon, 16 Sep 2024 10:09:28 +0530 Subject: [PATCH] Fixed tree related issues. --- web/pgadmin/static/js/components/PgTree/FileTreeX/index.tsx | 4 +++- web/pgadmin/static/js/tree/tree.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/web/pgadmin/static/js/components/PgTree/FileTreeX/index.tsx b/web/pgadmin/static/js/components/PgTree/FileTreeX/index.tsx index f5baec534..cc9237c77 100644 --- a/web/pgadmin/static/js/components/PgTree/FileTreeX/index.tsx +++ b/web/pgadmin/static/js/components/PgTree/FileTreeX/index.tsx @@ -611,7 +611,9 @@ export class FileTreeX extends React.Component { const scrollXPos = scrollX || 0; const scrollYPos = scrollY || this.props.model.state.scrollOffset; const div = this.wrapperRef.current.querySelector('div').querySelector('div') as HTMLDivElement; - div.scroll(scrollXPos, scrollYPos); + if (div) { + div.scroll(scrollXPos, scrollYPos); + } }; diff --git a/web/pgadmin/static/js/tree/tree.js b/web/pgadmin/static/js/tree/tree.js index fc6653899..bb13b7450 100644 --- a/web/pgadmin/static/js/tree/tree.js +++ b/web/pgadmin/static/js/tree/tree.js @@ -477,7 +477,7 @@ export class Tree { let result = {}; if (identifier === undefined) return; let item = TreeNode.prototype.isPrototypeOf(identifier) ? identifier : this.findNode(identifier.path); - if (item === undefined) return; + if (!item) return; do { const currentNodeData = item.getData(); if (currentNodeData._type in this.Nodes && this.Nodes[currentNodeData._type].hasId) {