diff --git a/web/pgadmin/static/js/tree/tree.js b/web/pgadmin/static/js/tree/tree.js
index c527ffc87..ab75728c1 100644
--- a/web/pgadmin/static/js/tree/tree.js
+++ b/web/pgadmin/static/js/tree/tree.js
@@ -92,6 +92,15 @@ export class Tree {
     return await this.tree.create(item, data);
   }
 
+  async destroy() {
+    const model = this.tree.getModel();
+    this.rootNode.children = [];
+    if (model.root) {
+      model.root.isExpanded = false;
+      await model.root.hardReloadChildren();
+    }
+  }
+
   next(item) {
     if(item) {
       let parent = this.parent(item);
