From 042999f728b68eae31056d9d99abbc32fe8963be Mon Sep 17 00:00:00 2001 From: ciaranbor <81697641+ciaranbor@users.noreply.github.com> Date: Mon, 16 Feb 2026 11:46:41 +0000 Subject: [PATCH] Ciaran/message deletion (#1409) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Motivation When a user deletes a message during an active streamed generation, it can cause unexpected behavior. The delete confirmation text was also misleading — it said "all responses after it" only for user messages, which didn't accurately describe the behavior (all messages after the deleted one are removed, regardless of role) ## Changes - Prevent deletion during streaming: Disabled the delete button and blocked handleDeleteClick when loading is true, with a visual indication (dimmed button, cursor-not-allowed, tooltip change) - Clarified delete confirmation text: Replaced role-specific wording with a simpler, accurate message: - Last message: "Delete this message?" - Any other message: "Delete this message and all messages after it?" ## Why It Works Guarding on the loading state at both the click handler and the button's disabled attribute ensures no deletion can be triggered while a response is being streamed ## Test Plan ### Manual Testing - Verify the delete button is visually disabled and non-clickable while a response is streaming - Verify the tooltip shows "Cannot delete while generating" during streaming - Verify the last message shows "Delete this message?" confirmation - Verify non-last messages show "Delete this message and all messages after it?" confirmation - Verify deletion works normally when not streaming --- .../src/lib/components/ChatMessages.svelte | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/dashboard/src/lib/components/ChatMessages.svelte b/dashboard/src/lib/components/ChatMessages.svelte index 46dfe46b..ba5322a7 100644 --- a/dashboard/src/lib/components/ChatMessages.svelte +++ b/dashboard/src/lib/components/ChatMessages.svelte @@ -225,6 +225,7 @@ } function handleDeleteClick(messageId: string) { + if (loading) return; deleteConfirmId = messageId; } @@ -255,7 +256,7 @@