File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,7 +103,6 @@ export function SidebarHistory({ user }: { user: User | undefined }) {
103103 isValidating,
104104 isLoading,
105105 mutate,
106- error,
107106 } = useSWRInfinite < ChatHistory > ( getChatHistoryPaginationKey , fetcher , {
108107 fallbackData : [ ] ,
109108 } ) ;
@@ -116,6 +115,10 @@ export function SidebarHistory({ user }: { user: User | undefined }) {
116115 ? paginatedChatHistories . some ( ( page ) => page . hasMore === false )
117116 : false ;
118117
118+ const hasEmptyChatHistory = paginatedChatHistories
119+ ? paginatedChatHistories . every ( ( page ) => page . chats . length === 0 )
120+ : false ;
121+
119122 const handleDelete = async ( ) => {
120123 const deletePromise = fetch ( `/api/chat?id=${ deleteId } ` , {
121124 method : 'DELETE' ,
@@ -186,7 +189,7 @@ export function SidebarHistory({ user }: { user: User | undefined }) {
186189 ) ;
187190 }
188191
189- if ( paginatedChatHistories ?. length === 0 ) {
192+ if ( hasEmptyChatHistory ) {
190193 return (
191194 < SidebarGroup >
192195 < SidebarGroupContent >
You can’t perform that action at this time.
0 commit comments