diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 9227c974..c4543085 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -96,6 +96,9 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { if (!conversations) { fetchConversations(); } + if (queries.length === 0) { + resetConversation(); + } }, [conversations, dispatch]); async function fetchConversations() { @@ -168,9 +171,8 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { ); }; const newChat = () => { - if (conversations && conversations?.length > 0) { + if (queries && queries?.length > 0) { resetConversation(); - navigate('/'); } }; async function updateConversationName(updatedConversation: { diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index 92ae0a4a..4341407e 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -49,6 +49,9 @@ export default function Conversation() { }; useEffect(() => { !eventInterrupt && scrollIntoView(); + if (queries.length == 0) { + resetConversation(); + } }, [queries.length, queries[queries.length - 1]]); useEffect(() => { @@ -132,8 +135,7 @@ export default function Conversation() { ); }; const newChat = () => { - resetConversation(); - navigate('/'); + if (queries && queries.length > 0) resetConversation(); }; const prepResponseView = (query: Query, index: number) => { @@ -213,11 +215,11 @@ export default function Conversation() { }, []); return (