From f368d703ddd256e593dc634b6405930398c3ab05 Mon Sep 17 00:00:00 2001 From: Chiguyong Date: Mon, 6 Jul 2026 16:13:29 +0800 Subject: [PATCH] fix(frontend): conversation deletion reappears after refresh for board meetings Root cause: private board meetings are persisted server-side as soon as board_started is emitted (portal intercepts and saves the message), but the frontend left the conversation marked is_local=true. deleteConversation skipped the server DELETE for local conversations, so only the in-memory list was updated; the next refresh reloaded the conversation from SQLite. Changes: - chatStream.ts: on board_started, mark the conversation is_local=false so the server delete is called. - chatStore.ts: loadConversations() now explicitly sets is_local=false for anything returned from the server as a safety net. Type-check passes (existing unrelated test-file node module errors remain). --- src/agentkit/server/frontend/src/stores/chatStore.ts | 3 +++ src/agentkit/server/frontend/src/stores/chatStream.ts | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/agentkit/server/frontend/src/stores/chatStore.ts b/src/agentkit/server/frontend/src/stores/chatStore.ts index e2f3d6f..0b3080b 100644 --- a/src/agentkit/server/frontend/src/stores/chatStore.ts +++ b/src/agentkit/server/frontend/src/stores/chatStore.ts @@ -209,6 +209,9 @@ export const useChatStore = defineStore("chat", () => { // @board meeting (board_started persisted). Frontend uses this // to render the "私董会" badge in the sidebar. is_board: conv.is_board === true, + // Anything returned from the server is already persisted — mark it + // non-local so deleteConversation routes to the server endpoint. + is_local: false, })); } catch (error) { console.error("Failed to load conversations:", error); diff --git a/src/agentkit/server/frontend/src/stores/chatStream.ts b/src/agentkit/server/frontend/src/stores/chatStream.ts index 3909275..f1e1870 100644 --- a/src/agentkit/server/frontend/src/stores/chatStream.ts +++ b/src/agentkit/server/frontend/src/stores/chatStream.ts @@ -1157,6 +1157,17 @@ export function dispatchWsEvent( board_round: 0, }; state.appendMessage(conversationId, startMsg); + // Board meetings are persisted server-side as soon as board_started + // is emitted (portal intercepts and saves the message). Mark the + // conversation non-local so deleteConversation calls the server + // instead of only removing it from the local list — otherwise the + // conversation reappears on the next refresh. + const conv = state.conversations.value.find( + (c) => c.id === conversationId, + ); + if (conv) { + conv.is_local = false; + } } break; }