@@ -26,7 +26,7 @@ import type { AnyTRPCRouter } from '@trpc/server'
26
26
import type { MaybeRefOrGetter } from '@vueuse/core'
27
27
import type { UnionToIntersection } from 'type-fest'
28
28
29
- type QueryType = 'query' | 'infinite'
29
+ type QueryType = 'query' | 'queries' | ' infinite'
30
30
export type TRPCQueryKey = [ readonly string [ ] , { input ?: unknown ; type ?: QueryType } ?]
31
31
32
32
export { type Exact } from './types'
@@ -78,10 +78,10 @@ function createVueQueryProxyDecoration<TRouter extends AnyTRPCRouter>(
78
78
function createQuery (
79
79
_input : MaybeRefOrGetter < unknown > ,
80
80
{ trpcOptions, queryOptions } : { trpcOptions : any ; queryOptions : any } ,
81
- { includeInput = false } = { } ,
81
+ { type = 'query' } : { type ?: QueryType } = { } ,
82
82
) {
83
83
return defineQueryOptions ( {
84
- queryKey : computed ( ( ) => getQueryKey ( path , toValue ( _input ) , 'query' ) ) ,
84
+ queryKey : computed ( ( ) => getQueryKey ( path , toValue ( _input ) , type ) ) ,
85
85
queryFn : async ( { signal } ) => {
86
86
const input = toValue ( _input )
87
87
@@ -90,7 +90,7 @@ function createVueQueryProxyDecoration<TRouter extends AnyTRPCRouter>(
90
90
...trpcOptions ,
91
91
} )
92
92
93
- if ( includeInput ) return { output, input }
93
+ if ( type === 'queries' ) return { output, input }
94
94
95
95
return output
96
96
} ,
@@ -111,7 +111,7 @@ function createVueQueryProxyDecoration<TRouter extends AnyTRPCRouter>(
111
111
return useQueries ( {
112
112
queries : computed ( ( ) =>
113
113
toValue ( inputs ) . map ( ( i ) =>
114
- createQuery ( i , { trpcOptions, queryOptions } , { includeInput : true } ) ,
114
+ createQuery ( i , { trpcOptions, queryOptions } , { type : 'queries' } ) ,
115
115
) ,
116
116
) ,
117
117
combine,
0 commit comments