chore: useMemo deps

This commit is contained in:
jialin
2026-06-03 18:28:31 +08:00
committed by jialin
parent c3d7a0b85e
commit caea43590a
3 changed files with 15 additions and 14 deletions
@@ -16,7 +16,7 @@ export default function useQuerySshkeys() {
>({
key: 'sshkeyOptions',
fetchList,
getLabel: (item) => item.displayName || (item?.name as string),
getLabel: (item) => item?.displayName || (item?.name as string),
getValue: (item) => item?.name as string
});
@@ -27,6 +27,7 @@ import {
} from '@gpustack/core-ui';
import { useIntl } from '@umijs/max';
import { Button, Tag } from 'antd';
import { useMemo } from 'react';
import styled from 'styled-components';
import { manufactureColorMap, templateActions } from '../config';
import { ListItem } from '../config/types';
@@ -135,18 +136,18 @@ interface TemplateCardProps {
const TemplateCardItem: React.FC<TemplateCardProps> = ({ data, onSelect }) => {
const intl = useIntl();
const manufacturerLabelMap: Record<string, string> = Object.values(
GPUsConfigs
).reduce(
(acc, item) => {
if (item.gpuVendor)
acc[item.gpuVendor] = item.locales.locale
? intl.formatMessage({ id: item.locales.label })
: item.locales.label;
return acc;
},
{ cpu: 'CPU' } as Record<string, string>
);
const manufacturerLabelMap: Record<string, string> = useMemo(() => {
return Object.values(GPUsConfigs).reduce(
(acc, item) => {
if (item.gpuVendor)
acc[item.gpuVendor] = item.locales.locale
? intl.formatMessage({ id: item.locales.label })
: item.locales.label;
return acc;
},
{ cpu: 'CPU' } as Record<string, string>
);
}, [intl]);
const handleOnSelect = (item: any) => {
onSelect?.({ action: item.key, data });
@@ -52,7 +52,7 @@ const Basic: React.FC<BasicProps> = ({
: item.locales.label,
value: item.gpuVendor
})),
[]
[intl]
);
const renderStorageLabel = (): React.ReactNode => {