diff --git a/web/pgadmin/browser/templates/browser/js/browser.js b/web/pgadmin/browser/templates/browser/js/browser.js index a663ae8..aceda92 100644 --- a/web/pgadmin/browser/templates/browser/js/browser.js +++ b/web/pgadmin/browser/templates/browser/js/browser.js @@ -1207,10 +1207,8 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) { // if label is different then we need to // refresh parent so that node get properly // placed in tree - if(this.d.label != this.new.label) { - var p = this.t.parent(this.i); - pgAdmin.Browser.onRefreshTreeNode(p); - } + var is_refresh_required = this.d.label != this.new.label, + parent_item = this.t.parent(this.i); self.t.openPath(self.i); self.t.deselect(self.i); @@ -1218,6 +1216,9 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) { // select tree item after few milliseconds setTimeout(function() { self.t.select(self.i); + if (is_refresh_required && parent_item.length) { + pgAdmin.Browser.onRefreshTreeNode(parent_item); + } }, 10); } }