From 8e2992d37ee22852721f0b107cce6a22b585c42e Mon Sep 17 00:00:00 2001 From: gagik Date: Wed, 5 Mar 2025 16:12:44 +0100 Subject: [PATCH] fix(connection-form)!: use a simpler parameter for differentiating Atlas and non-Atlas connections Since `adjustConnectionOptionsBeforeConnect` is used in places like VSCode where we may not have the same concept of atlasMetadata, it is better for us to be more direct with our parameters and simply ask for `isAtlas`. --- .../src/stores/connections-store-redux.ts | 5 ++++- packages/connection-form/src/hooks/use-connect-form.ts | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/compass-connections/src/stores/connections-store-redux.ts b/packages/compass-connections/src/stores/connections-store-redux.ts index fbe6b14a83f..7c15cb51dfd 100644 --- a/packages/compass-connections/src/stores/connections-store-redux.ts +++ b/packages/compass-connections/src/stores/connections-store-redux.ts @@ -1554,7 +1554,10 @@ const connectWithOptions = ( cloneDeep(connectionOptions), SecretsForConnection.get(connectionInfo.id) ?? {} ), - connectionInfo, + connectionInfo: { + id: connectionInfo.id, + isAtlas: !!connectionInfo.atlasMetadata, + }, defaultAppName: appName, preferences: { forceConnectionOptions: forceConnectionOptions ?? [], diff --git a/packages/connection-form/src/hooks/use-connect-form.ts b/packages/connection-form/src/hooks/use-connect-form.ts index bfad34f1073..1dccd3639ff 100644 --- a/packages/connection-form/src/hooks/use-connect-form.ts +++ b/packages/connection-form/src/hooks/use-connect-form.ts @@ -849,7 +849,10 @@ export function adjustConnectionOptionsBeforeConnect({ preferences, }: { connectionOptions: Readonly; - connectionInfo: Readonly>; + connectionInfo: { + id: string; + isAtlas: boolean; + }; defaultAppName?: string; notifyDeviceFlow?: (deviceFlowInformation: { verificationUrl: string; @@ -869,7 +872,7 @@ export function adjustConnectionOptionsBeforeConnect({ setAppNameParamIfMissing({ defaultAppName, connectionId: connectionInfo.id, - isAtlas: !!connectionInfo.atlasMetadata, + isAtlas: connectionInfo.isAtlas, telemetryAnonymousId: preferences.telemetryAnonymousId, }), adjustOIDCConnectionOptionsBeforeConnect({