fix: model list cache data refresh
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { WatchEventType } from '@/config';
|
import { WatchEventType } from '@/config';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { useRef } from 'react';
|
import { useEffect, useRef } from 'react';
|
||||||
|
|
||||||
interface ChunkedCollection {
|
interface ChunkedCollection {
|
||||||
ids: string[];
|
ids: string[];
|
||||||
@@ -20,6 +20,10 @@ export function useUpdateChunkedList(options: {
|
|||||||
const cacheDataListRef = useRef<any[]>(options.dataList || []);
|
const cacheDataListRef = useRef<any[]>(options.dataList || []);
|
||||||
const timerRef = useRef<any>(null);
|
const timerRef = useRef<any>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
cacheDataListRef.current = [...(options.dataList || [])];
|
||||||
|
}, [options.dataList]);
|
||||||
|
|
||||||
const debounceUpdateChunckedList = () => {
|
const debounceUpdateChunckedList = () => {
|
||||||
clearTimeout(timerRef.current);
|
clearTimeout(timerRef.current);
|
||||||
timerRef.current = setTimeout(() => {
|
timerRef.current = setTimeout(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user