From 2fa9598fb4fb9830ddabcdc1d32acd0940b58c19 Mon Sep 17 00:00:00 2001 From: iMADi-ARCH Date: Sun, 11 Jun 2023 17:54:00 +0530 Subject: [PATCH] fix(chat): update chats list when creating a new chat --- frontend/app/chat/ChatsProvider/hooks/useChats.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/app/chat/ChatsProvider/hooks/useChats.ts b/frontend/app/chat/ChatsProvider/hooks/useChats.ts index 850cc148c..a54609245 100644 --- a/frontend/app/chat/ChatsProvider/hooks/useChats.ts +++ b/frontend/app/chat/ChatsProvider/hooks/useChats.ts @@ -108,11 +108,11 @@ export default function useChats() { }; if (!chatId) { // Creating a new chat - // setAllChats((chats) => { - // console.log({ chats }); - // return [...chats, newChat]; - // }); console.log("---- Creating a new chat ----"); + setAllChats((chats) => { + console.log({ chats }); + return [...chats, newChat]; + }); setChat(newChat); router.push(`/chat/${response.data.chatId}`); } @@ -139,7 +139,7 @@ export default function useChats() { const resetChat = async () => { setChat(null); - } + }; useEffect(() => { fetchAllChats();