Skip to content
Discussion options

You must be logged in to vote

Alright, after digging deeper, I discovered the problem. The issue lies with the state of pageParams when using useInfiniteScroll in reverse mode, i.e., getPreviousPage instead of getNextPage. In this scenario, the page parameters are stored in the wrong order, causing the issue. Ideally, with reverse pagination, Tanstack Query should intelligently store the page parameters in reverse order to maintain the pagination flow.

Nevertheless, for future reference, there are two solutions you can choose from:

  1. Rely solely on getNextPageParam and avoid using getPreviousPageParam (this is the solution I chose), which should work fine.
  2. Utilize the select callback under the query option for useInfin…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@KamaniBhavin
Comment options

@KamaniBhavin
Comment options

Answer selected by KamaniBhavin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant