@@ -7,7 +7,7 @@ import type {
77 NI ,
88} from '@data-client/core' ;
99import { ExpiryStatus } from '@data-client/core' ;
10- import { useMemo } from 'react' ;
10+ import { useEffect , useMemo } from 'react' ;
1111
1212import useCacheState from './useCacheState.js' ;
1313import useController from '../hooks/useController.js' ;
@@ -39,7 +39,7 @@ export default function useCache<
3939 const meta = state . meta [ key ] ;
4040
4141 // Compute denormalized value
42- const { data, expiryStatus, expiresAt } = useMemo ( ( ) => {
42+ const { data, expiryStatus, expiresAt, countRef } = useMemo ( ( ) => {
4343 return controller . getResponse ( endpoint , ...args , state ) ;
4444 // eslint-disable-next-line react-hooks/exhaustive-deps
4545 } , [
@@ -69,6 +69,9 @@ export default function useCache<
6969 const loading = expiryStatus !== ExpiryStatus . Valid && expired ;
7070 /****************************************************************************************************/
7171
72+ // eslint-disable-next-line react-hooks/exhaustive-deps
73+ useEffect ( countRef , [ data ] ) ;
74+
7275 return useMemo ( ( ) => {
7376 // if useSuspense() would suspend, don't include entities from cache
7477 if ( loading ) {
0 commit comments