File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,13 @@ import {
22 computed ,
33 getCurrentScope ,
44 onScopeDispose ,
5- readonly ,
6- ref ,
5+ shallowReadonly ,
6+ shallowRef ,
77 watch ,
88} from 'vue-demi'
99import { useQueryClient } from './useQueryClient'
1010import { cloneDeepUnref } from './utils'
11- import type { DeepReadonly , Ref } from 'vue-demi'
11+ import type { Ref } from 'vue-demi'
1212import type {
1313 MutationFilters as MF ,
1414 Mutation ,
@@ -68,10 +68,12 @@ function getResult<TResult = MutationState>(
6868export function useMutationState < TResult = MutationState > (
6969 options : MutationStateOptions < TResult > = { } ,
7070 queryClient ?: QueryClient ,
71- ) : DeepReadonly < Ref < Array < TResult > > > {
71+ ) : Readonly < Ref < Array < TResult > > > {
7272 const filters = computed ( ( ) => cloneDeepUnref ( options . filters ) )
7373 const mutationCache = ( queryClient || useQueryClient ( ) ) . getMutationCache ( )
74- const state = ref ( getResult ( mutationCache , options ) ) as Ref < Array < TResult > >
74+ const state = shallowRef ( getResult ( mutationCache , options ) ) as Ref <
75+ Array < TResult >
76+ >
7577 const unsubscribe = mutationCache . subscribe ( ( ) => {
7678 const result = getResult ( mutationCache , options )
7779 state . value = result
@@ -85,5 +87,5 @@ export function useMutationState<TResult = MutationState>(
8587 unsubscribe ( )
8688 } )
8789
88- return readonly ( state )
90+ return shallowReadonly ( state )
8991}
You can’t perform that action at this time.
0 commit comments