Skip to content

Commit 112c724

Browse files
committed
Use useHasNonGenuineConnections hook in assistant drawer
1 parent 13cbca6 commit 112c724

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useConnectionIds } from '@mongodb-js/compass-connections/provider';
1+
import { useHasNonGenuineConnections } from '@mongodb-js/compass-app-stores/provider';
22
import React from 'react';
33
import { CompassAssistantDrawer } from '@mongodb-js/compass-assistant';
44

@@ -10,15 +10,12 @@ export function CompassAssistantDrawerWithConnections({
1010
}: {
1111
appName: string;
1212
}) {
13-
// Check for non-genuine connections
14-
const activeNonGenuineConnectionIds = useConnectionIds(
15-
(conn) =>
16-
conn.info.isGenuineMongoDB === false && conn.status === 'connected'
17-
);
13+
const hasNonGenuineConnections = useHasNonGenuineConnections();
14+
1815
return (
1916
<CompassAssistantDrawer
2017
appName={appName}
21-
hasNonGenuineConnections={activeNonGenuineConnectionIds.length > 0}
18+
hasNonGenuineConnections={hasNonGenuineConnections}
2219
/>
2320
);
2421
}
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useConnectionIds } from '@mongodb-js/compass-connections/provider';
1+
import { useHasNonGenuineConnections } from '@mongodb-js/compass-app-stores/provider';
22
import React from 'react';
33
import { CompassAssistantDrawer } from '@mongodb-js/compass-assistant';
44

@@ -10,15 +10,12 @@ export function CompassAssistantDrawerWithConnections({
1010
}: {
1111
appName: string;
1212
}) {
13-
// Check for non-genuine connections
14-
const activeNonGenuineConnectionIds = useConnectionIds(
15-
(conn) =>
16-
conn.info.isGenuineMongoDB === false && conn.status === 'connected'
17-
);
13+
const hasNonGenuineConnections = useHasNonGenuineConnections();
14+
1815
return (
1916
<CompassAssistantDrawer
2017
appName={appName}
21-
hasNonGenuineConnections={activeNonGenuineConnectionIds.length > 0}
18+
hasNonGenuineConnections={hasNonGenuineConnections}
2219
/>
2320
);
2421
}

0 commit comments

Comments
 (0)