diff --git a/src/components/Menu/ChatHistoryList.tsx b/src/components/Menu/ChatHistoryList.tsx index 14513d9..0c4a4a2 100644 --- a/src/components/Menu/ChatHistoryList.tsx +++ b/src/components/Menu/ChatHistoryList.tsx @@ -1,5 +1,6 @@ import React, { useEffect, useRef, useState } from 'react'; import useStore from '@store/store'; +import { shallow } from 'zustand/shallow'; import ChatIcon from '@icon/ChatIcon'; import EditIcon from '@icon/EditIcon'; @@ -11,16 +12,19 @@ import useInitialiseNewChat from '@hooks/useInitialiseNewChat'; const ChatHistoryList = () => { const setCurrentChatIndex = useStore((state) => state.setCurrentChatIndex); - const chats = useStore((state) => state.chats); + const chatTitles = useStore( + (state) => state.chats?.map((chat) => chat.title), + shallow + ); return (
- {chats && - chats.map((chat, index) => ( + {chatTitles && + chatTitles.map((title, index) => ( { setCurrentChatIndex(index); diff --git a/src/hooks/useSubmit.ts b/src/hooks/useSubmit.ts index c810624..3412e9f 100644 --- a/src/hooks/useSubmit.ts +++ b/src/hooks/useSubmit.ts @@ -142,8 +142,6 @@ const useSubmit = () => { updatedChats[currentChatIndex].title = title; updatedChats[currentChatIndex].titleSet = true; setChats(updatedChats); - console.log(message); - console.log(title); } } catch (e: unknown) { const err = (e as Error).message;