useInfiniteList
Hello.
I am using useInfiniteList, how do I make it so that when I load new elements, they are added to the beginning and not to the end?
7 Replies
Hi @RomaY. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. However, you can refer to the useInfiniteList documentation (https://refine.dev/docs/api-reference/core/hooks/data/useInfiniteList) for more information on how to use this hook.
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------useInfiniteList | refine
useInfiniteList data hook from refine is a modified version of TanStack Query's useInfiniteQuery for retrieving items from a resource with pagination, search, sort, and filter configurations.
<@538717491908575242> kapa.ai is still learning and improving, please let us how it did by reacting below
deep-jadeOP•2y ago
Because if I use const allPages = [].concat(...(data?.pages ?? []).map((page) => page.data));
then the elements are repeated, then I just make a map by pages and a map by page, but I can't sort the pages
Who can help me?
fascinating-indigo•2y ago
Hello @RomaY , you can use sorters for that: https://refine.dev/docs/api-reference/core/hooks/data/useInfiniteList/#sorters
useInfiniteList | refine
useInfiniteList data hook from refine is a modified version of TanStack Query's useInfiniteQuery for retrieving items from a resource with pagination, search, sort, and filter configurations.
deep-jadeOP•2y ago
Hello. is it client-side or server-side sorting? because I'm doing a chat and uploading new messages to the bottom, so my upload button is at the top, and I'd like them to just add from the top
I found where my mistake was
fascinating-indigo•2y ago
Hello @RomaY , I'm glad your issue is solved. Could you share the issue for future reference so if someone has a similar issue, it can be helpful?