Improve useInfiniteQuery type #7302
Unanswered
ArianHamdi
asked this question in
Ideas
Replies: 1 comment 4 replies
-
getNextPageParam is required because when refetching, we start at the first page and go forward from there |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, the
getNextPageParam
function is required, butgetPreviousPageParam
is optional inuseInfiniteQuery
. In some cases, like messaging, we fetch the last page and only want to fetch previous pages, so havinggetNextPageParam
required doesn't make a lot of sense. I would suggest creating a union to ensure that the user passes at least one of the functions, eithergetNextPageParam
orgetPreviousPageParam
.Beta Was this translation helpful? Give feedback.
All reactions