Fix floating promises in connection widget (#8198)

* Fix floating promises in connection widget

* PR feedback

* More feedback changes

* Couple missed promises
This commit is contained in:
Charles Gagnon
2019-11-04 07:24:38 -08:00
committed by GitHub
parent 97f852c3d6
commit 5dc7049f8c
3 changed files with 24 additions and 15 deletions

View File

@@ -323,12 +323,14 @@ export class ConnectionDialogWidget extends Modal {
const controller = new RecentConnectionTreeController(leftClick, actionProvider, this._connectionManagementService, this._contextMenuService);
actionProvider.onRecentConnectionRemoved(() => {
const recentConnections: ConnectionProfile[] = this._connectionManagementService.getRecentConnections();
this.open(recentConnections.length > 0);
this.open(recentConnections.length > 0).catch(err => this.logService.error(`Unexpected error opening connection widget after a recent connection was removed from action provider: ${err}`));
// We're just using the connections to determine if there are connections to show, dispose them right after to clean up their handlers
recentConnections.forEach(conn => conn.dispose());
});
controller.onRecentConnectionRemoved(() => {
const recentConnections: ConnectionProfile[] = this._connectionManagementService.getRecentConnections();
this.open(recentConnections.length > 0);
this.open(recentConnections.length > 0).catch(err => this.logService.error(`Unexpected error opening connection widget after a recent connection was removed from controller : ${err}`));
// We're just using the connections to determine if there are connections to show, dispose them right after to clean up their handlers
recentConnections.forEach(conn => conn.dispose());
});
this._recentConnectionTree = TreeCreationUtils.createConnectionTree(treeContainer, this._instantiationService, controller);
@@ -399,7 +401,7 @@ export class ConnectionDialogWidget extends Modal {
await TreeUpdateUtils.structuralTreeUpdate(this._recentConnectionTree, 'recent', this._connectionManagementService, this._providers);
// reset saved connection tree
this._savedConnectionTree.setInput([]);
await this._savedConnectionTree.setInput([]);
// call layout with view height
this.layout();