From 03adfd4898d78ba9d68db17fd23bae90dd2cafc4 Mon Sep 17 00:00:00 2001 From: JeevaRamanathan Date: Thu, 3 Oct 2024 23:34:56 +0530 Subject: [PATCH] fix:navigation and deletion issues in conversations Signed-off-by: JeevaRamanathan --- frontend/src/Navigation.tsx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 87cbbe51..7d3333ee 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -119,6 +119,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { .delete(id, {}) .then(() => { fetchConversations(); + resetConversation(); }) .catch((error) => console.error(error)); }; @@ -155,6 +156,15 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { }); }; + const resetConversation = () => { + dispatch(setConversation([])); + dispatch( + updateConversationId({ + query: { conversationId: null }, + }), + ); + }; + async function updateConversationName(updatedConversation: { name: string; id: string; @@ -235,14 +245,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { { - dispatch(setConversation([])); - dispatch( - updateConversationId({ - query: { conversationId: null }, - }), - ); - }} + onClick={resetConversation} className={({ isActive }) => `${ isActive ? 'bg-gray-3000 dark:bg-transparent' : '' @@ -310,6 +313,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { isActive ? 'bg-gray-3000 dark:bg-transparent' : '' }` } + onClick={resetConversation} >