diff --git a/docs/en_US/release_notes_4_12.rst b/docs/en_US/release_notes_4_12.rst index b71efd47f..52621269d 100644 --- a/docs/en_US/release_notes_4_12.rst +++ b/docs/en_US/release_notes_4_12.rst @@ -14,6 +14,7 @@ New features | `Issue #4540 `_ - Use the full tab space for CodeMirror instances on dialogues where appropriate. | `Issue #4549 `_ - Allow a banner to be displayed on the login and other related pages showing custom text. | `Issue #4566 `_ - Allow enhanced cookie protection to be disabled for compatibility with dynamically addressed hosting environments. +| `Issue #4570 `_ - Add an optimisation to the internal code responsible for searching for treeview nodes. Housekeeping ************ diff --git a/web/pgadmin/browser/static/js/menu.js b/web/pgadmin/browser/static/js/menu.js index e76c9ed20..3bcba0220 100644 --- a/web/pgadmin/browser/static/js/menu.js +++ b/web/pgadmin/browser/static/js/menu.js @@ -78,7 +78,12 @@ define([ data: this.data, }).addClass('dropdown-item'); - this.is_disabled = this.disabled(node, item); + if(this.context !== undefined) { + this.is_disabled = this.context.disabled; + } else { + this.is_disabled = this.disabled(node, item); + } + if (this.icon) { url.append($('', { 'class': this.icon, diff --git a/web/pgadmin/static/js/tree/tree.js b/web/pgadmin/static/js/tree/tree.js index 2e616be7f..33397e80d 100644 --- a/web/pgadmin/static/js/tree/tree.js +++ b/web/pgadmin/static/js/tree/tree.js @@ -300,6 +300,15 @@ function findInTree(rootNode, path) { } return (function findInNode(currentNode) { + + /* No point in checking the children if + * the path for currentNode itself is not matching + */ + if (currentNode.path !== undefined && path !== undefined + && !path.startsWith(currentNode.path)) { + return null; + } + for (let i = 0, length = currentNode.children.length; i < length; i++) { const calculatedNode = findInNode(currentNode.children[i]); if (calculatedNode !== null) {