@@ -10,6 +10,7 @@ import type {
1010} from '@seamapi/http/connect'
1111import type { ActionAttempt } from '@seamapi/types/connect'
1212import {
13+ type QueryKey ,
1314 useInfiniteQuery ,
1415 type UseInfiniteQueryOptions ,
1516 type UseInfiniteQueryResult ,
@@ -29,19 +30,20 @@ export function useSeamInfiniteQuery<
2930 T extends SeamHttpEndpointPaginatedQueryPaths ,
3031> (
3132 endpointPath : T ,
32- parameters ? : UseSeamInfiniteQueryParameters < T > ,
33+ parameters : UseSeamInfiniteQueryParameters < T > = { } ,
3334 options : Parameters < SeamHttpEndpoints [ T ] > [ 1 ] &
3435 QueryOptions < QueryData < T > , QueryError < T > > = { }
35- ) : UseSeamInfiniteQueryResult < T > {
36+ ) : UseSeamInfiniteQueryResult < T > & { queryKey : QueryKey } {
3637 const { endpointClient : client , queryKeyPrefixes } = useSeamClient ( )
37- return useInfiniteQuery ( {
38+ const queryKey = [
39+ ...queryKeyPrefixes ,
40+ ...endpointPath . split ( '/' ) . filter ( ( v ) => v !== '' ) ,
41+ parameters ,
42+ ]
43+ const result = useInfiniteQuery ( {
3844 enabled : client != null ,
3945 ...options ,
40- queryKey : [
41- ...queryKeyPrefixes ,
42- ...endpointPath . split ( '/' ) . filter ( ( v ) => v !== '' ) ,
43- parameters ,
44- ] ,
46+ queryKey,
4547 initialPageParam : null ,
4648 getNextPageParam : ( lastPage ) => lastPage . nextPageCursor ,
4749 queryFn : async ( { pageParam } ) => {
@@ -72,6 +74,7 @@ export function useSeamInfiniteQuery<
7274 }
7375 } ,
7476 } )
77+ return { ...result , queryKey }
7578}
7679
7780interface QueryData < T extends SeamHttpEndpointPaginatedQueryPaths > {
0 commit comments