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).
This commit is contained in:
Chiguyong 2026-07-06 16:13:29 +08:00
parent 5c0021e4bd
commit f368d703dd
2 changed files with 14 additions and 0 deletions

View File

@ -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);

View File

@ -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;
}