From 68ee5e4054548400a5f968fdfd5af1a4a0111900 Mon Sep 17 00:00:00 2001 From: sw3205933776 <3205933776@qq.com> Date: Wed, 5 Nov 2025 17:59:21 +0800 Subject: [PATCH 1/2] fix: force home page refresh after ending project (#609) --- src/components/TopBar/index.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/TopBar/index.tsx b/src/components/TopBar/index.tsx index 0e6c4c89f..c1fe76e5d 100644 --- a/src/components/TopBar/index.tsx +++ b/src/components/TopBar/index.tsx @@ -162,11 +162,15 @@ function HeaderWin() { console.log("Task may not exist on backend:", error); } - // Delete from history - try { - await proxyFetchDelete(`/api/chat/history/${taskId}`); - } catch (error) { - console.log("Task may not exist in history:", error); + // Delete from history using historyId + const projectId = projectStore.activeProjectId; + const historyId = projectId ? projectStore.getHistoryId(projectId) : null; + if (historyId) { + try { + await proxyFetchDelete(`/api/chat/history/${historyId}`); + } catch (error) { + console.log("History may not exist:", error); + } } // Remove from local store @@ -176,8 +180,8 @@ function HeaderWin() { const newTaskId = chatStore.create(); chatStore.setActiveTaskId(newTaskId); - // Navigate to home - navigate("/"); + // Navigate to home with replace to force refresh + navigate("/", { replace: true }); toast.success(t("layout.project-ended-successfully"), { closeButton: true, From bfc54244595758a31227627dda6021baac9bddb3 Mon Sep 17 00:00:00 2001 From: Wendong-Fan Date: Thu, 6 Nov 2025 03:27:39 +0800 Subject: [PATCH 2/2] enhance: force home page refresh after ending project PR610 --- src/components/TopBar/index.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/TopBar/index.tsx b/src/components/TopBar/index.tsx index c1fe76e5d..03e65ce4a 100644 --- a/src/components/TopBar/index.tsx +++ b/src/components/TopBar/index.tsx @@ -145,9 +145,12 @@ function HeaderWin() { return; } + const projectId = projectStore.activeProjectId; + const historyId = projectId ? projectStore.getHistoryId(projectId) : null; + try { const task = chatStore.tasks[taskId]; - + // Stop the task if it's running if (task && task.status === 'running') { await fetchPut(`/task/${taskId}/take-control`, { @@ -163,14 +166,14 @@ function HeaderWin() { } // Delete from history using historyId - const projectId = projectStore.activeProjectId; - const historyId = projectId ? projectStore.getHistoryId(projectId) : null; if (historyId) { try { await proxyFetchDelete(`/api/chat/history/${historyId}`); } catch (error) { console.log("History may not exist:", error); } + } else { + console.warn("No historyId found for project, skipping history deletion"); } // Remove from local store