chore: useMemo deps
This commit is contained in:
@@ -16,7 +16,7 @@ export default function useQuerySshkeys() {
|
|||||||
>({
|
>({
|
||||||
key: 'sshkeyOptions',
|
key: 'sshkeyOptions',
|
||||||
fetchList,
|
fetchList,
|
||||||
getLabel: (item) => item.displayName || (item?.name as string),
|
getLabel: (item) => item?.displayName || (item?.name as string),
|
||||||
getValue: (item) => item?.name as string
|
getValue: (item) => item?.name as string
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import {
|
|||||||
} from '@gpustack/core-ui';
|
} from '@gpustack/core-ui';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Button, Tag } from 'antd';
|
import { Button, Tag } from 'antd';
|
||||||
|
import { useMemo } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { manufactureColorMap, templateActions } from '../config';
|
import { manufactureColorMap, templateActions } from '../config';
|
||||||
import { ListItem } from '../config/types';
|
import { ListItem } from '../config/types';
|
||||||
@@ -135,18 +136,18 @@ interface TemplateCardProps {
|
|||||||
const TemplateCardItem: React.FC<TemplateCardProps> = ({ data, onSelect }) => {
|
const TemplateCardItem: React.FC<TemplateCardProps> = ({ data, onSelect }) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
||||||
const manufacturerLabelMap: Record<string, string> = Object.values(
|
const manufacturerLabelMap: Record<string, string> = useMemo(() => {
|
||||||
GPUsConfigs
|
return Object.values(GPUsConfigs).reduce(
|
||||||
).reduce(
|
(acc, item) => {
|
||||||
(acc, item) => {
|
if (item.gpuVendor)
|
||||||
if (item.gpuVendor)
|
acc[item.gpuVendor] = item.locales.locale
|
||||||
acc[item.gpuVendor] = item.locales.locale
|
? intl.formatMessage({ id: item.locales.label })
|
||||||
? intl.formatMessage({ id: item.locales.label })
|
: item.locales.label;
|
||||||
: item.locales.label;
|
return acc;
|
||||||
return acc;
|
},
|
||||||
},
|
{ cpu: 'CPU' } as Record<string, string>
|
||||||
{ cpu: 'CPU' } as Record<string, string>
|
);
|
||||||
);
|
}, [intl]);
|
||||||
|
|
||||||
const handleOnSelect = (item: any) => {
|
const handleOnSelect = (item: any) => {
|
||||||
onSelect?.({ action: item.key, data });
|
onSelect?.({ action: item.key, data });
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ const Basic: React.FC<BasicProps> = ({
|
|||||||
: item.locales.label,
|
: item.locales.label,
|
||||||
value: item.gpuVendor
|
value: item.gpuVendor
|
||||||
})),
|
})),
|
||||||
[]
|
[intl]
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderStorageLabel = (): React.ReactNode => {
|
const renderStorageLabel = (): React.ReactNode => {
|
||||||
|
|||||||
Reference in New Issue
Block a user