Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/compass-web/src/connection-storage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
16 changes: 4 additions & 12 deletions packages/compass-web/src/connection-storage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: () => {
Expand Down Expand Up @@ -265,7 +262,7 @@ export class AtlasCloudConnectionStorage
implements ConnectionStorage
{
private loadAllPromise: Promise<ConnectionInfo[]> | undefined;
private canUseNewConnectionInfoEndpoint = true;
private useNewConnectionInfoEndpoint = true;
constructor(
private atlasService: AtlasService,
private orgId: string,
Expand Down Expand Up @@ -420,15 +417,10 @@ export class AtlasCloudConnectionStorage

loadAll(): Promise<ConnectionInfo[]> {
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;
});
Expand Down
Loading