Support using queryOptions
in useInfiniteQuery
#7309
-
// we can do this
export const contactDetailQuery = (id: string) =>
queryOptions({
queryKey: ['contacts', 'detail', id],
queryFn: async () => getContact(id),
})
// but we can't...
export const contactListQuery = (id: string) =>
queryOptions({
queryKey: ['contacts', 'list'],
queryFn: async ({ pageParam }) => getContactList(pageParam),
initialPageParam: 0,
getNextPageParam: (lastPage, pages) => lastPage.nextCursor,
}) I'm happy if |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@dora1998 We have |
Beta Was this translation helpful? Give feedback.
-
But would be nice to have the same for |
Beta Was this translation helpful? Give feedback.
@dora1998 We have
infiniteQueryOptions
for this - https://tanstack.com/query/latest/docs/framework/react/reference/infiniteQueryOptions#infinitequeryoptions