mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-06-06 18:31:00 +00:00
30 mins caching for allContentids query
This commit is contained in:
parent
34e116e9cc
commit
3cb64a9a16
@ -23,8 +23,8 @@ export function useContentIdsQuery() {
|
|||||||
const { data: contentIds, isLoading: contentIdsLoading, error: contentIdsError, refetch: refetchContentIds } = useQuery({
|
const { data: contentIds, isLoading: contentIdsLoading, error: contentIdsError, refetch: refetchContentIds } = useQuery({
|
||||||
queryKey: ['contentIds', isClient],
|
queryKey: ['contentIds', isClient],
|
||||||
queryFn: fetchContentIdsDB,
|
queryFn: fetchContentIdsDB,
|
||||||
// staleTime: 1000 * 60 * 30, // 30 minutes
|
staleTime: 1000 * 60 * 30, // 30 minutes
|
||||||
// refetchInterval: 1000 * 60 * 30, // 30 minutes
|
refetchInterval: 1000 * 60 * 30, // 30 minutes
|
||||||
enabled: isClient
|
enabled: isClient
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
import { useState, useEffect } from 'react';
|
|
||||||
|
|
||||||
export function useDebounce(value, delay) {
|
|
||||||
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const handler = setTimeout(() => {
|
|
||||||
setDebouncedValue(value);
|
|
||||||
}, delay);
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
clearTimeout(handler);
|
|
||||||
};
|
|
||||||
}, [value, delay]);
|
|
||||||
|
|
||||||
return debouncedValue;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user