@@ -56,10 +56,13 @@ export class DevupQueryClient<S extends ConditionalKeys<DevupApiServers>> {
5656 queryClient ?: Parameters < typeof useQuery < D , E > > [ 1 ] ,
5757 ]
5858 >
59- ) : ReturnType < typeof useQuery < D , E > > {
60- return useQuery < D , E > (
59+ ) : ReturnType < typeof useQuery < D , E > > & {
60+ queryKey : [ M , T , ...unknown [ ] ]
61+ } {
62+ const queryKey = getQueryKey ( method , path , options [ 0 ] )
63+ const result = useQuery < D , E > (
6164 {
62- queryKey : getQueryKey ( method , path , options [ 0 ] ) ,
65+ queryKey,
6366 queryFn : ( {
6467 queryKey : [ method , path , ...options ] ,
6568 signal,
@@ -78,6 +81,7 @@ export class DevupQueryClient<S extends ConditionalKeys<DevupApiServers>> {
7881 } ,
7982 options [ 2 ] ,
8083 )
84+ return Object . assign ( result , { queryKey } )
8185 }
8286
8387 useMutation <
@@ -134,10 +138,13 @@ export class DevupQueryClient<S extends ConditionalKeys<DevupApiServers>> {
134138 queryClient ?: Parameters < typeof useSuspenseQuery < D , E > > [ 1 ] ,
135139 ]
136140 >
137- ) : ReturnType < typeof useSuspenseQuery < D , E > > {
138- return useSuspenseQuery < D , E , D > (
141+ ) : ReturnType < typeof useSuspenseQuery < D , E > > & {
142+ queryKey : [ M , T , ...unknown [ ] ]
143+ } {
144+ const queryKey = getQueryKey ( method , path , options [ 0 ] )
145+ const result = useSuspenseQuery < D , E , D > (
139146 {
140- queryKey : getQueryKey ( method , path , options [ 0 ] ) ,
147+ queryKey,
141148 queryFn : ( {
142149 queryKey : [ method , path , ...options ] ,
143150 signal,
@@ -156,6 +163,7 @@ export class DevupQueryClient<S extends ConditionalKeys<DevupApiServers>> {
156163 } ,
157164 options [ 2 ] ,
158165 )
166+ return Object . assign ( result , { queryKey } )
159167 }
160168
161169 useInfiniteQuery <
@@ -180,13 +188,16 @@ export class DevupQueryClient<S extends ConditionalKeys<DevupApiServers>> {
180188 > ,
181189 queryClient ?: Parameters < typeof useInfiniteQuery < D , E > > [ 1 ] ,
182190 ]
183- ) : ReturnType < typeof useInfiniteQuery < D , E > > {
191+ ) : ReturnType < typeof useInfiniteQuery < D , E > > & {
192+ queryKey : [ M , T , ...unknown [ ] ]
193+ } {
184194 const { getNextPageParam, initialPageParam, ...apiOptions } = options [ 0 ]
185- return useInfiniteQuery < D , E > (
195+ const queryKey = getQueryKey ( method , path , apiOptions )
196+ const result = useInfiniteQuery < D , E > (
186197 {
187198 getNextPageParam,
188199 initialPageParam,
189- queryKey : getQueryKey ( method , path , apiOptions ) ,
200+ queryKey,
190201 queryFn : ( { queryKey, pageParam, signal } ) : Promise < D > => {
191202 const [ methodKey , pathKey , ...restOptions ] = queryKey
192203 const apiOptions = restOptions [ 0 ] as DevupApiRequestInit | undefined
@@ -212,6 +223,7 @@ export class DevupQueryClient<S extends ConditionalKeys<DevupApiServers>> {
212223 } as Parameters < typeof useInfiniteQuery < D , E > > [ 0 ] ,
213224 options [ 2 ] ,
214225 )
226+ return Object . assign ( result , { queryKey } )
215227 }
216228
217229 useQueries <
0 commit comments