perf: auto refresh split data

This commit is contained in:
archer
2023-04-24 23:41:11 +08:00
parent ec86847280
commit 3294be5e7f
5 changed files with 16 additions and 8 deletions

View File

@@ -93,10 +93,16 @@ const ModelDataCard = ({ modelId }: { modelId: string }) => {
(num = 1) => {
getData(num);
refetch();
return null;
},
[getData, refetch]
);
useQuery(['refetchData'], () => refetchData(pageNum), {
refetchInterval: 5000,
enabled: splitDataLen > 0
});
// 获取所有的数据,并导出 json
const { mutate: onclickExport, isLoading: isLoadingExport = false } = useMutation({
mutationFn: () => getExportDataList(modelId),
@@ -170,7 +176,7 @@ const ModelDataCard = ({ modelId }: { modelId: string }) => {
</Menu>
</Flex>
<Flex mt={4}>
{splitDataLen > 0 && <Box fontSize={'xs'}>{splitDataLen}...</Box>}
{splitDataLen > 0 && <Box fontSize={'xs'}>{splitDataLen}...</Box>}
<Box flex={1} />
<Input
maxW={'240px'}