From 0bd179c6cadeaa5cb1a78abe8ff626a323b5608b Mon Sep 17 00:00:00 2001 From: Matt Irvine Date: Mon, 8 Oct 2018 15:41:55 -0700 Subject: [PATCH] Fix bug where connections edited in connection dialog moved to bottom of group (#2782) --- src/sql/parts/connection/common/connectionConfig.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sql/parts/connection/common/connectionConfig.ts b/src/sql/parts/connection/common/connectionConfig.ts index 83a858c86e..5d94f9dd85 100644 --- a/src/sql/parts/connection/common/connectionConfig.ts +++ b/src/sql/parts/connection/common/connectionConfig.ts @@ -84,13 +84,14 @@ export class ConnectionConfig implements IConnectionConfig { return providerConnectionProfile.matches(connectionProfile); }); if (sameProfileInList) { - profiles = profiles.filter(value => value !== sameProfileInList); + let profileIndex = profiles.findIndex(value => value === sameProfileInList); newProfile.id = sameProfileInList.id; connectionProfile.id = sameProfileInList.id; + profiles[profileIndex] = newProfile; + } else { + profiles.push(newProfile); } - profiles.push(newProfile); - this.writeConfiguration(Constants.connectionsArrayName, profiles).then(() => { resolve(connectionProfile); }).catch(err => {