File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change 1- import { computed , onScopeDispose , ref , watch } from 'vue-demi'
1+ import { onScopeDispose , ref , watchSyncEffect } from 'vue-demi'
22import { useQueryClient } from './useQueryClient'
3- import { cloneDeepUnref } from './utils'
43import type { Ref } from 'vue-demi'
54import type { QueryFilters as QF } from '@tanstack/query-core'
65import type { MaybeRefDeep } from './types'
@@ -12,18 +11,17 @@ export function useIsFetching(
1211 fetchingFilters : MaybeRefDeep < QF > = { } ,
1312 queryClient ?: QueryClient ,
1413) : Ref < number > {
15- const filters = computed ( ( ) => cloneDeepUnref ( fetchingFilters ) )
1614 const client = queryClient || useQueryClient ( )
1715
18- const isFetching = ref ( client . isFetching ( filters ) )
16+ const isFetching = ref ( )
1917
20- const unsubscribe = client . getQueryCache ( ) . subscribe ( ( ) => {
21- isFetching . value = client . isFetching ( filters )
22- } )
18+ const listener = ( ) => {
19+ isFetching . value = client . isFetching ( fetchingFilters )
20+ }
2321
24- watch ( filters , ( ) => {
25- isFetching . value = client . isFetching ( filters )
26- } )
22+ const unsubscribe = client . getQueryCache ( ) . subscribe ( listener )
23+
24+ watchSyncEffect ( listener )
2725
2826 onScopeDispose ( ( ) => {
2927 unsubscribe ( )
You can’t perform that action at this time.
0 commit comments