Skip to content

Commit de5074e

Browse files
committed
feat: make input available in useQueries() combine()
1 parent 4a747f7 commit de5074e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/index.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,20 @@ function createVueQueryProxyDecoration<TRouter extends AnyTRPCRouter>(
7676
}
7777

7878
function createQuery(
79-
input: MaybeRefOrGetter<unknown>,
79+
_input: MaybeRefOrGetter<unknown>,
8080
{ trpcOptions, queryOptions }: { trpcOptions: any; queryOptions: any },
8181
) {
82+
const input = toValue(_input)
83+
8284
return defineQueryOptions({
83-
queryKey: computed(() => getQueryKey(path, toValue(input), 'query')),
84-
queryFn: async ({ queryKey, signal }) =>
85-
trpc.query(joinedPath, queryKey[1]?.input, {
85+
queryKey: computed(() => getQueryKey(path, input, 'query')),
86+
queryFn: async ({ signal }) => ({
87+
output: await trpc.query(joinedPath, input, {
8688
signal,
8789
...trpcOptions,
8890
}),
91+
input,
92+
}),
8993
...maybeToRefs(queryOptions),
9094
})
9195
}

0 commit comments

Comments
 (0)