T
TanStack3y ago
complex-teal

Hi, I'm trying to use infiniteQuery in version 5, but the typing is not returning the item pages

function useListUsersInfinite(
options?: IListUserWithPagination & { page?: number },
params?: UseInfiniteQueryOptions<IPaginate<User>>
) {
return useInfiniteQuery({
queryKey: [QUERY_USERS_INFINITE, options],
initialPageParam: 1,
queryFn: ({ pageParam }) => {
return listUserWithPagination({
...options,
page: pageParam as number,
});
},
getNextPageParam: (lastPage) => {
const { currentPage, totalPages } = lastPage.meta;
return currentPage < totalPages ? currentPage + 1 : undefined;
},
...params,
});
}
function useListUsersInfinite(
options?: IListUserWithPagination & { page?: number },
params?: UseInfiniteQueryOptions<IPaginate<User>>
) {
return useInfiniteQuery({
queryKey: [QUERY_USERS_INFINITE, options],
initialPageParam: 1,
queryFn: ({ pageParam }) => {
return listUserWithPagination({
...options,
page: pageParam as number,
});
},
getNextPageParam: (lastPage) => {
const { currentPage, totalPages } = lastPage.meta;
return currentPage < totalPages ? currentPage + 1 : undefined;
},
...params,
});
}
No description
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?