TanStackT
TanStack3y ago
6 replies
specific-silver

Store non-sequential page with Infinite Query

Hi, is it possible to store result page of queryfn of useInfiniteQuery non-sequentially when a custom a custom page param is passed to fetchNextPage function of useInfiniteQuery

eg. When we do this:
// Pass your own page param const skipToCursor50 = () => fetchNextPage({ pageParam: 50 }) }

the result is still this:
data:{ pages:[..//otherpages, //pagewithCursor50], pageParams:[..//otherpageparams,// pageparamswithCursor50], }

My original problem statement is to display search results in a messageslist inline like whatsapp or skype. The messages list are paginated and uses useInfiniteQuery. Its a little too long to explain the complete problem, but I can if required.
Was this page helpful?