From 9cc9e8876b72edb33ae6c7c6e7ed5a5bdf864041 Mon Sep 17 00:00:00 2001 From: Chewbacca Date: Mon, 5 Dec 2022 08:41:26 -0500 Subject: [PATCH] Fix infinite pagination of chats --- app/soapbox/queries/chats.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/soapbox/queries/chats.ts b/app/soapbox/queries/chats.ts index 3cfeeeda2..96ad97ce8 100644 --- a/app/soapbox/queries/chats.ts +++ b/app/soapbox/queries/chats.ts @@ -169,7 +169,10 @@ const useChats = (search?: string) => { }, }); - const data = flattenPages(queryInfo.data); + const data = queryInfo.data?.pages.reduce( + (prev: IChat[], curr) => [...prev, ...curr.result], + [], + ); const chatsQuery = { ...queryInfo,