diff --git a/packages/compass-web/src/connection-storage.spec.ts b/packages/compass-web/src/connection-storage.spec.ts index 6253b48add7..ca1568c21e5 100644 --- a/packages/compass-web/src/connection-storage.spec.ts +++ b/packages/compass-web/src/connection-storage.spec.ts @@ -166,7 +166,10 @@ describe('buildConnectionInfoFromClusterDescription', function () { deployment ); - expect(connectionInfo).to.have.property('id', clusterDescription.name); + expect(connectionInfo).to.have.property( + 'id', + clusterDescription.uniqueId + ); expect(connectionInfo).to.have.nested.property( 'connectionOptions.connectionString', diff --git a/packages/compass-web/src/connection-storage.tsx b/packages/compass-web/src/connection-storage.tsx index 64265b8cc2a..8c42fad9bac 100644 --- a/packages/compass-web/src/connection-storage.tsx +++ b/packages/compass-web/src/connection-storage.tsx @@ -207,10 +207,7 @@ export function buildConnectionInfoFromClusterDescription( const instanceSize = getInstanceSize(description); return { - // Cluster name is unique inside the project (hence using it in the backend - // urls as identifier) and using it as an id makes our job of mapping routes - // to compass state easier - id: description.name, + id: description.uniqueId, connectionOptions: { connectionString: connectionString.toString(), lookup: () => { @@ -265,7 +262,7 @@ export class AtlasCloudConnectionStorage implements ConnectionStorage { private loadAllPromise: Promise | undefined; - private canUseNewConnectionInfoEndpoint = true; + private useNewConnectionInfoEndpoint = true; constructor( private atlasService: AtlasService, private orgId: string, @@ -420,15 +417,10 @@ export class AtlasCloudConnectionStorage loadAll(): Promise { this.loadAllPromise ??= (async () => { - if (this.canUseNewConnectionInfoEndpoint === false) { - return this._loadAndNormalizeClusterDescriptionInfoV1(); - } - try { - return await this._loadAndNormalizeClusterDescriptionInfoV2(); - } catch (err) { - this.canUseNewConnectionInfoEndpoint = false; + if (this.useNewConnectionInfoEndpoint === false) { return this._loadAndNormalizeClusterDescriptionInfoV1(); } + return await this._loadAndNormalizeClusterDescriptionInfoV2(); })().finally(() => { delete this.loadAllPromise; });