diff --git a/web/package.json b/web/package.json
index 27907da95..ffe7131d7 100644
--- a/web/package.json
+++ b/web/package.json
@@ -150,7 +150,7 @@
     "xterm-addon-fit": "^0.5.0",
     "xterm-addon-search": "^0.8.0",
     "xterm-addon-web-links": "^0.4.0",
-    "pgadmin4-tree": "git+https://github.com/EnterpriseDB/pgadmin4-treeview/#76d7801ae6c179a5efd3c826c1bd91446a2436fb",
+    "pgadmin4-tree": "git+https://github.com/EnterpriseDB/pgadmin4-treeview/#c66e5e0533cfc622915e85eed0adc3ac38305c61",
     "react-aspen": "^1.1.0",
     "@types/classnames": "^2.2.6",
     "@types/react": "^16.7.18",
diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
index 628799eaf..562705b40 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
@@ -282,7 +282,8 @@ define('pgadmin.node.database', [
           }
 
           pgBrowser.tree.addIcon(item, {icon: data.icon});
-          if (!data.connected && data.allowConn) {
+          if (!data.connected && data.allowConn && !data.is_connecting) {
+            data.is_connecting = true;
             connect_to_database(this, data, pgBrowser.tree, item, true);
             return false;
           }
@@ -295,7 +296,8 @@ define('pgadmin.node.database', [
           }
 
           pgBrowser.tree.addIcon(item, {icon: data.icon});
-          if (!data.connected && data.allowConn) {
+          if (!data.connected && data.allowConn && !data.is_connecting) {
+            data.is_connecting = true;
             connect_to_database(this, data, pgBrowser.tree, item, false);
             return false;
           }
@@ -416,6 +418,7 @@ define('pgadmin.node.database', [
           onFailure = function(
             xhr, status, error, _model, _data, _tree, _item, _status
           ) {
+            data.is_connecting = false;
             if (xhr.status != 200 && xhr.responseText.search('Ticket expired') !== -1) {
               tree.addIcon(_item, {icon: 'icon-server-connecting'});
               let fetchTicket = Kerberos.fetch_ticket();
@@ -454,10 +457,6 @@ define('pgadmin.node.database', [
             res, model, _data, _tree, _item, _connected
           ) {
             _data.is_connecting = false;
-            if (!_connected) {
-              _tree.deselect(_item);
-              _tree.setInode(_item);
-            }
             if (res && res.data) {
               if(typeof res.data.connected == 'boolean') {
                 _data.connected = res.data.connected;
diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js
index a0bef78bd..c1ce90856 100644
--- a/web/pgadmin/browser/static/js/browser.js
+++ b/web/pgadmin/browser/static/js/browser.js
@@ -1075,23 +1075,19 @@ define('pgadmin.browser', [
                 };
 
               if (binarySearch()) {
-                __ctx.t.before(i, {
-                  itemData: _data,
-                  success: function() {
-                    if (
-                      __ctx.o && __ctx.o.success && typeof(__ctx.o.success) == 'function'
-                    ) {
-                      __ctx.o.success.apply(__ctx.t, [i, _data]);
-                    }
-                  },
-                  fail: function() {
-                    console.warn('Failed to add before...', arguments);
-                    if (
-                      __ctx.o && __ctx.o.fail && typeof(__ctx.o.fail) == 'function'
-                    ) {
-                      __ctx.o.fail.apply(__ctx.t, [i, _data]);
-                    }
-                  },
+                __ctx.t.before(i, _data).then(() => {
+                  if (
+                    __ctx.o && __ctx.o.success && typeof(__ctx.o.success) == 'function'
+                  ) {
+                    __ctx.o.success.apply(__ctx.t, [i, _data]);
+                  }
+                }, () => {
+                  console.warn('Failed to add before...', arguments);
+                  if (
+                    __ctx.o && __ctx.o.fail && typeof(__ctx.o.fail) == 'function'
+                  ) {
+                    __ctx.o.fail.apply(__ctx.t, [i, _data]);
+                  }
                 });
               } else {
                 var _append = function() {
@@ -1570,32 +1566,26 @@ define('pgadmin.browser', [
                 };
 
               if (binarySearch()) {
-                __ctx.t.before(i, {
-                  itemData: _new,
-                  success: function() {
-                    var new_item = $(arguments[1].items[0]);
-                    __ctx.t.openPath(new_item);
-                    __ctx.t.select(new_item);
-                    if (
-                      __ctx.o && __ctx.o.success && typeof(__ctx.o.success) == 'function'
-                    ) {
-                      __ctx.o.success.apply(__ctx.t, [i, _old, _new]);
-                    }
-                  },
-                  fail: function() {
-                    console.warn('Failed to add before..', arguments);
-                    if (
-                      __ctx.o && __ctx.o.fail && typeof(__ctx.o.fail) == 'function'
-                    ) {
-                      __ctx.o.fail.apply(__ctx.t, [i, _old, _new]);
-                    }
-                  },
+                __ctx.t.before(i, _new).then((new_item) => {
+                  __ctx.t.openPath(new_item);
+                  __ctx.t.select(new_item);
+                  if (
+                    __ctx.o && __ctx.o.success && typeof(__ctx.o.success) == 'function'
+                  ) {
+                    __ctx.o.success.apply(__ctx.t, [i, _old, _new]);
+                  }
+                }, () => {
+                  console.warn('Failed to add before..', arguments);
+                  if (
+                    __ctx.o && __ctx.o.fail && typeof(__ctx.o.fail) == 'function'
+                  ) {
+                    __ctx.o.fail.apply(__ctx.t, [i, _old, _new]);
+                  }
                 });
               } else {
                 var _appendNode = function() {
                   __ctx.t.append(__ctx.i, _new).then(
-                    () => {
-                      var new_item = $(arguments[1].items[0]);
+                    (new_item) => {
                       __ctx.t.openPath(new_item);
                       __ctx.t.select(new_item);
                       if (
diff --git a/web/pgadmin/static/js/tree/tree.js b/web/pgadmin/static/js/tree/tree.js
index 4f2822c51..01da52d9c 100644
--- a/web/pgadmin/static/js/tree/tree.js
+++ b/web/pgadmin/static/js/tree/tree.js
@@ -77,7 +77,7 @@ export class Tree {
   }
 
   async before(item, data) {
-    await this.tree.create(item.parent, data.itemData);
+    return await this.tree.create(item.parent, data);
   }
 
   async update(item, data) {
diff --git a/web/yarn.lock b/web/yarn.lock
index 007e2201d..6137775c9 100644
--- a/web/yarn.lock
+++ b/web/yarn.lock
@@ -7577,9 +7577,9 @@ performance-now@^2.1.0:
   resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
   integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
 
-"pgadmin4-tree@git+https://github.com/EnterpriseDB/pgadmin4-treeview/#76d7801ae6c179a5efd3c826c1bd91446a2436fb":
+"pgadmin4-tree@git+https://github.com/EnterpriseDB/pgadmin4-treeview/#c66e5e0533cfc622915e85eed0adc3ac38305c61":
   version "1.0.0"
-  resolved "git+https://github.com/EnterpriseDB/pgadmin4-treeview/#76d7801ae6c179a5efd3c826c1bd91446a2436fb"
+  resolved "git+https://github.com/EnterpriseDB/pgadmin4-treeview/#c66e5e0533cfc622915e85eed0adc3ac38305c61"
   dependencies:
     "@types/classnames" "^2.2.6"
     "@types/react" "^16.7.18"
