Skip to content

Commit a0310ef

Browse files
authored
Merge pull request #176 from dgageot/speed-up-tools-tab
Improve the speed of the Tools tab
2 parents 9e0f0b6 + 972cb77 commit a0310ef

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/extension/ui/src/components/tabs/ToolCatalog.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface ToolCatalogProps {
1212
}
1313

1414
const ToolCatalog: React.FC<ToolCatalogProps> = ({ search, client, showMine }) => {
15-
const { catalogItems } = useCatalogAll(client)
15+
const { catalogItems, registryLoading } = useCatalogAll(client)
1616

1717
// Memoize the filtered catalog items to prevent unnecessary recalculations
1818
const filteredCatalogItems = useMemo(() => {
@@ -31,6 +31,7 @@ const ToolCatalog: React.FC<ToolCatalogProps> = ({ search, client, showMine }) =
3131
<Tile
3232
item={catalogItem}
3333
client={client}
34+
registryLoading={registryLoading}
3435
/>
3536
</Grid2>
3637
)

src/extension/ui/src/components/tile/Index.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@ import {
99
Dialog,
1010
DialogContent,
1111
DialogTitle,
12-
Divider,
1312
IconButton,
1413
Stack,
1514
TextField,
16-
Typography,
15+
Typography
1716
} from '@mui/material';
1817
import { useState } from 'react';
1918

2019
import { MCP_POLICY_NAME } from '../../Constants';
21-
import { useCatalogAll, useCatalogOperations } from '../../queries/useCatalog';
20+
import { useCatalogOperations } from '../../queries/useCatalog';
2221
import { useSecrets } from '../../queries/useSecrets';
2322
import { CatalogItemRichened } from '../../types/catalog';
2423
import Bottom from './Bottom';
@@ -29,9 +28,10 @@ import Top from './Top';
2928
type TileProps = {
3029
item: CatalogItemRichened;
3130
client: v1.DockerDesktopClient;
31+
registryLoading: boolean;
3232
};
3333

34-
const Tile = ({ item, client }: TileProps) => {
34+
const Tile = ({ item, client, registryLoading }: TileProps) => {
3535
const [showSecretDialog, setShowSecretDialog] = useState(false);
3636
const [assignedSecrets] = useState<{ name: string; assigned: boolean }[]>([]);
3737
const [changedSecrets, setChangedSecrets] = useState<{
@@ -43,7 +43,6 @@ const Tile = ({ item, client }: TileProps) => {
4343
useSecrets(client);
4444
const { registerCatalogItem, unregisterCatalogItem } =
4545
useCatalogOperations(client);
46-
const { registryLoading } = useCatalogAll(client);
4746

4847
if (registryLoading || secretsLoading) {
4948
return (
@@ -140,12 +139,12 @@ const Tile = ({ item, client }: TileProps) => {
140139
</Stack>
141140
</DialogContent>
142141
</Dialog>
143-
<ConfigurationModal
142+
{showConfigModal && <ConfigurationModal
144143
open={showConfigModal}
145144
onClose={() => setShowConfigModal(false)}
146145
catalogItem={item}
147146
client={client}
148-
/>
147+
/>}
149148
<Card>
150149
<CardActionArea
151150
sx={{ padding: 1.5 }}

0 commit comments

Comments
 (0)