diff --git a/src/hooks/moderation/useEntityCache.ts b/src/hooks/moderation/useEntityCache.ts index 05637170..b14a586c 100644 --- a/src/hooks/moderation/useEntityCache.ts +++ b/src/hooks/moderation/useEntityCache.ts @@ -1,4 +1,4 @@ -import { useRef, useCallback } from 'react'; +import { useRef, useCallback, useMemo } from 'react'; import { supabase } from '@/integrations/supabase/client'; /** @@ -221,7 +221,7 @@ export function useEntityCache() { */ const getCacheRef = useCallback(() => cacheRef.current, []); - return { + return useMemo(() => ({ getCached, has, setCached, @@ -233,5 +233,17 @@ export function useEntityCache() { getSize, getTotalSize, getCacheRef, - }; + }), [ + getCached, + has, + setCached, + getUncachedIds, + bulkFetch, + fetchRelatedEntities, + clear, + clearAll, + getSize, + getTotalSize, + getCacheRef, + ]); } diff --git a/src/hooks/moderation/useProfileCache.ts b/src/hooks/moderation/useProfileCache.ts index 1a1ca761..c3cc839b 100644 --- a/src/hooks/moderation/useProfileCache.ts +++ b/src/hooks/moderation/useProfileCache.ts @@ -1,4 +1,4 @@ -import { useRef, useCallback } from 'react'; +import { useRef, useCallback, useMemo } from 'react'; import { supabase } from '@/integrations/supabase/client'; /** @@ -181,7 +181,7 @@ export function useProfileCache() { */ const getCacheRef = useCallback(() => cacheRef.current, []); - return { + return useMemo(() => ({ getCached, has, setCached, @@ -195,5 +195,19 @@ export function useProfileCache() { getSize, getAllCachedIds, getCacheRef, - }; + }), [ + getCached, + has, + setCached, + getUncachedIds, + bulkFetch, + fetchAsMap, + fetchForSubmissions, + getDisplayName, + invalidate, + clear, + getSize, + getAllCachedIds, + getCacheRef, + ]); }