diff --git a/frontend/src/components/LeftSidebar/ThreadList.tsx b/frontend/src/components/LeftSidebar/ThreadList.tsx
index 19a1d4d0be..f267025869 100644
--- a/frontend/src/components/LeftSidebar/ThreadList.tsx
+++ b/frontend/src/components/LeftSidebar/ThreadList.tsx
@@ -101,25 +101,23 @@ export function ThreadList({
const handleDeleteThread = () => {
if (!threadIdToDelete) return;
+ if (
+ threadIdToDelete === idToResume ||
+ threadIdToDelete === currentThreadId
+ ) {
+ clear();
+ }
toast.promise(apiClient.deleteThread(threadIdToDelete), {
loading: (
),
success: () => {
- if (
- threadIdToDelete === idToResume ||
- threadIdToDelete === currentThreadId
- ) {
- clear();
- }
- if (threadIdToDelete === threadHistory.currentThreadId) {
- navigate('/');
- }
setThreadHistory((prev) => ({
...prev,
threads: prev?.threads?.filter((t) => t.id !== threadIdToDelete)
}));
+ navigate('/');
return (
);