Skip to content

Commit b195a5d

Browse files
committed
fixup: remove unused, move check higher up
1 parent 89b8dbc commit b195a5d

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

packages/compass-generative-ai/src/atlas-ai-service.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,13 @@ export class AtlasAiService {
239239
connectionInfo?: ConnectionInfo
240240
) {
241241
if (this.apiURLPreset === 'cloud') {
242+
const atlasMetadata = connectionInfo?.atlasMetadata;
243+
if (!atlasMetadata) {
244+
throw new Error(
245+
"Can't perform generative ai request: atlasMetadata is not available"
246+
);
247+
}
248+
242249
if (urlId === 'user-access') {
243250
return this.atlasService.cloudEndpoint(
244251
aiURLConfig[this.apiURLPreset][urlId](
@@ -247,13 +254,6 @@ export class AtlasAiService {
247254
);
248255
}
249256

250-
const atlasMetadata = connectionInfo?.atlasMetadata;
251-
if (!atlasMetadata) {
252-
throw new Error(
253-
"Can't perform generative ai request: atlasMetadata is not available"
254-
);
255-
}
256-
257257
return this.atlasService.cloudEndpoint(
258258
aiURLConfig[this.apiURLPreset][urlId](atlasMetadata.projectId)
259259
);

packages/compass-web/src/entrypoint.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ import { useCompassWebLoggerAndTelemetry } from './logger-and-telemetry';
5959
import { type TelemetryServiceOptions } from '@mongodb-js/compass-telemetry';
6060
import { WorkspaceTab as WelcomeWorkspaceTab } from '@mongodb-js/compass-welcome';
6161

62-
const WithAtlasProviders: React.FC<{
63-
projectId: string;
64-
}> = ({ children }) => {
62+
const WithAtlasProviders: React.FC = ({ children }) => {
6563
return (
6664
<AtlasCloudAuthServiceProvider>
6765
<AtlasServiceProvider>
@@ -319,7 +317,7 @@ const CompassWeb = ({
319317
<PreferencesProvider value={preferencesAccess.current}>
320318
<LoggerProvider value={logger}>
321319
<TelemetryProvider options={telemetryOptions.current}>
322-
<WithAtlasProviders projectId={projectId}>
320+
<WithAtlasProviders>
323321
<AtlasCloudConnectionStorageProvider
324322
orgId={orgId}
325323
projectId={projectId}

0 commit comments

Comments
 (0)