From 427ec061b46f62a0e600a1fd61055b8957fad858 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Sun, 9 Feb 2025 11:38:44 -0800 Subject: [PATCH] Add auto redirect on delete of current conversation --- .../app/components/allConversations/allConversations.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/interface/web/app/components/allConversations/allConversations.tsx b/src/interface/web/app/components/allConversations/allConversations.tsx index 353f2dbb..0d1c1b88 100644 --- a/src/interface/web/app/components/allConversations/allConversations.tsx +++ b/src/interface/web/app/components/allConversations/allConversations.tsx @@ -164,7 +164,12 @@ function deleteConversation(conversationId: string) { }) .then((response) => { response.json(); - mutate("/api/chat/sessions"); + // If currently viewing the conversation, redirect to the home page + if (window.location.search.includes(`conversationId=${conversationId}`)) { + window.location.href = "/"; + } else { + mutate("/api/chat/sessions"); + } }) .then((data) => { }) .catch((err) => {