diff --git a/src/components/AIChatHistory/AIChatHistory.tsx b/src/components/AIChatHistory/AIChatHistory.tsx index 1fca720f0..12982c9f2 100644 --- a/src/components/AIChatHistory/AIChatHistory.tsx +++ b/src/components/AIChatHistory/AIChatHistory.tsx @@ -49,7 +49,7 @@ export function AIChatHistory(props: AIChatHistoryProps) { setIsChatHistoryLoading(false); }, [data, chatHistoryId]); - const isDataLoading = isLoading || isBillingDetailsLoading; + const showGlobalLoader = isLoading || isBillingDetailsLoading; const hasError = chatHistoryError || billingDetailsError; useEffect(() => { @@ -58,24 +58,19 @@ export function AIChatHistory(props: AIChatHistoryProps) { } setIsLoading(false); + setIsChatHistoryLoading(false); }, [hasError]); return (
- {isDataLoading && !hasError && ( + {showGlobalLoader && (
)} - {!isDataLoading && hasError && ( -
- -
- )} - - {!isDataLoading && !hasError && ( + {!showGlobalLoader && ( <> {isPaidUser && ( - {isChatHistoryLoading && ( + {isChatHistoryLoading && !hasError && (
)} - {!isChatHistoryLoading && ( + {!isChatHistoryLoading && hasError && ( +
+ +
+ )} + + {!isChatHistoryLoading && !hasError && ( { + if (!data) { + return; + } + + setIsLoading(false); + }, [data?.pages]); + const groupedChatHistory = useMemo(() => { const today = DateTime.now().startOf('day'); const allHistories = data?.pages?.flatMap((page) => page.data); @@ -85,7 +94,7 @@ export function ListChatHistory(props: ListChatHistoryProps) { if (!isOpen) { return ( -
+
- +
diff --git a/src/queries/chat-history.ts b/src/queries/chat-history.ts index cc4b420fe..4f540c0c4 100644 --- a/src/queries/chat-history.ts +++ b/src/queries/chat-history.ts @@ -87,7 +87,7 @@ export function listChatHistoryOptions( return httpGet('/v1-list-chat-history', { ...(query?.query ? { query: query.query } : {}), ...(pageParam ? { currPage: pageParam } : {}), - perPage: '21', + perPage: '2', }); }, enabled: !!isLoggedIn(),