mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 08:46:39 -06:00
Trigger the browser tree destroyed event so the consequences of destroying the tree are handled properly.
This commit is contained in:
parent
2dd009eb7c
commit
2324337149
@ -555,11 +555,12 @@ export default function PreferencesComponent({ ...props }) {
|
||||
gettext('Object explorer refresh required'),
|
||||
gettext('An object explorer refresh is required. Do you wish to refresh it now?'),
|
||||
function () {
|
||||
pgAdmin.Browser.tree.destroy({
|
||||
success: function () {
|
||||
pgAdmin.Browser.tree.destroy().then(
|
||||
() => {
|
||||
pgAdmin.Browser.Events.trigger('pgadmin-browser:tree:destroyed', undefined, undefined);
|
||||
return true;
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
},
|
||||
function () {
|
||||
return true;
|
||||
|
@ -42,6 +42,7 @@ export default function withStandardTabInfo(Component, tabId) {
|
||||
setNodeInfo([true, item, data]);
|
||||
};
|
||||
|
||||
let destroyTree = pgAdmin.Browser.Events.on('pgadmin-browser:tree:destroyed', onUpdate);
|
||||
let deregisterTree = pgAdmin.Browser.Events.on('pgadmin-browser:node:selected', onUpdate);
|
||||
let deregisterTreeUpdate = pgAdmin.Browser.Events.on('pgadmin-browser:tree:updated', onUpdate);
|
||||
let deregisterDbConnected = pgAdmin.Browser.Events.on('pgadmin:database:connected', onUpdate);
|
||||
@ -54,6 +55,7 @@ export default function withStandardTabInfo(Component, tabId) {
|
||||
|
||||
return ()=>{
|
||||
onTabActive?.cancel();
|
||||
destroyTree();
|
||||
deregisterTree();
|
||||
deregisterTreeUpdate();
|
||||
deregisterDbConnected();
|
||||
|
@ -120,7 +120,7 @@ export class Tree {
|
||||
this.rootNode.children = [];
|
||||
if (model.root) {
|
||||
model.root.isExpanded = false;
|
||||
await model.root.hardReloadChildren();
|
||||
return Promise.resolve(await model.root.hardReloadChildren());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user