Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-08-18 20:59:50 +02:00
parent cbee2ff018
commit e73341d1a9
7 changed files with 35 additions and 20 deletions

View File

@@ -38,7 +38,7 @@ const useChatMessages = (chat: Chat) => {
gcTime: 0,
staleTime: 0,
initialPageParam: { next: null as (() => Promise<PaginatedResponse<BaseChatMessage>>) | null },
getNextPageParam: (config) => config,
getNextPageParam: (config) => config.next ? config : undefined,
});
const data = flattenPages<ChatMessage>(queryInfo.data as any)?.toReversed();
@@ -76,7 +76,7 @@ const useChats = () => {
placeholderData: keepPreviousData,
enabled: features.chats && !!me,
initialPageParam: { next: null as (() => Promise<PaginatedResponse<Chat>>) | null },
getNextPageParam: (config) => config,
getNextPageParam: (config) => config.next ? config : undefined,
});
const data = flattenPages(queryInfo.data);