Skip to content

Commit 3c0f5bb

Browse files
authored
refactor(connection-form)!: use a simpler parameter for differentiating Atlas and non-Atlas connections (#6773)
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`.
1 parent dad404d commit 3c0f5bb

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

packages/compass-connections/src/stores/connections-store-redux.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,10 @@ const connectWithOptions = (
15541554
cloneDeep(connectionOptions),
15551555
SecretsForConnection.get(connectionInfo.id) ?? {}
15561556
),
1557-
connectionInfo,
1557+
connectionInfo: {
1558+
id: connectionInfo.id,
1559+
isAtlas: !!connectionInfo.atlasMetadata,
1560+
},
15581561
defaultAppName: appName,
15591562
preferences: {
15601563
forceConnectionOptions: forceConnectionOptions ?? [],

packages/connection-form/src/hooks/use-connect-form.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,10 @@ export function adjustConnectionOptionsBeforeConnect({
849849
preferences,
850850
}: {
851851
connectionOptions: Readonly<ConnectionOptions>;
852-
connectionInfo: Readonly<Pick<ConnectionInfo, 'id' | 'atlasMetadata'>>;
852+
connectionInfo: {
853+
id: string;
854+
isAtlas: boolean;
855+
};
853856
defaultAppName?: string;
854857
notifyDeviceFlow?: (deviceFlowInformation: {
855858
verificationUrl: string;
@@ -869,7 +872,7 @@ export function adjustConnectionOptionsBeforeConnect({
869872
setAppNameParamIfMissing({
870873
defaultAppName,
871874
connectionId: connectionInfo.id,
872-
isAtlas: !!connectionInfo.atlasMetadata,
875+
isAtlas: connectionInfo.isAtlas,
873876
telemetryAnonymousId: preferences.telemetryAnonymousId,
874877
}),
875878
adjustOIDCConnectionOptionsBeforeConnect({

0 commit comments

Comments
 (0)