fix:navigation and deletion issues in conversations

Signed-off-by: JeevaRamanathan <jeevaramanathan.m@infosys.com>
This commit is contained in:
JeevaRamanathan
2024-10-03 23:34:56 +05:30
parent 8c8bf8702f
commit 03adfd4898

View File

@@ -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) {
</div>
<NavLink
to={'/'}
onClick={() => {
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}
>
<img
src={SettingGear}
@@ -329,6 +333,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
isActive ? 'bg-gray-3000 dark:bg-[#28292E]' : ''
}`
}
onClick={resetConversation}
>
<img
src={Info}