Fix infinite pagination of chats

This commit is contained in:
Chewbacca 2022-12-05 08:41:26 -05:00
parent 4a48e9d510
commit 9cc9e8876b
1 changed files with 4 additions and 1 deletions

View File

@ -169,7 +169,10 @@ const useChats = (search?: string) => {
}, },
}); });
const data = flattenPages(queryInfo.data); const data = queryInfo.data?.pages.reduce<IChat[]>(
(prev: IChat[], curr) => [...prev, ...curr.result],
[],
);
const chatsQuery = { const chatsQuery = {
...queryInfo, ...queryInfo,