fix: model list cache data refresh

This commit is contained in:
jialin
2024-09-14 20:09:25 +08:00
parent 1fe42a6eda
commit af02db17cf
+5 -1
View File
@@ -1,6 +1,6 @@
import { WatchEventType } from '@/config';
import _ from 'lodash';
import { useRef } from 'react';
import { useEffect, useRef } from 'react';
interface ChunkedCollection {
ids: string[];
@@ -20,6 +20,10 @@ export function useUpdateChunkedList(options: {
const cacheDataListRef = useRef<any[]>(options.dataList || []);
const timerRef = useRef<any>(null);
useEffect(() => {
cacheDataListRef.current = [...(options.dataList || [])];
}, [options.dataList]);
const debounceUpdateChunckedList = () => {
clearTimeout(timerRef.current);
timerRef.current = setTimeout(() => {