From 8abf1d35be368ac257f1edf76d5f53f7a9c64b98 Mon Sep 17 00:00:00 2001 From: Aero Date: Sat, 29 Nov 2025 22:20:15 +0800 Subject: [PATCH] agent_ui: Fix delete icon event in history panel (#43796) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary Fixed the thread deletion issue by: 1. Click handler conflict between the trash icon and the main ListItem 2. Added `cx.stop_propagation()` to prevent the click event from bubbling up to the parent ListItem's click handler 3. Followed the established `cx.stop_propagation()` pattern used throughout the codebase Now when you click the trash icon to delete a thread: - ✅ The thread deletion happens immediately on the first click - ✅ No race condition between deletion and activation - ✅ No double-clicking required The fix is minimal, follows established patterns, and addresses the exact root cause of the issue. - Stop event propagation in thread removal handler Release Notes: - agent: Improved delete thread action in the history view by preventing it from also triggering the thread activation. --- crates/agent_ui/src/acp/thread_history.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/agent_ui/src/acp/thread_history.rs b/crates/agent_ui/src/acp/thread_history.rs index e5c83d48f1fd4633591441ad88076e66d3eb1e62..1aa89b35d34c8c0543a56014fee7766b6de66eb2 100644 --- a/crates/agent_ui/src/acp/thread_history.rs +++ b/crates/agent_ui/src/acp/thread_history.rs @@ -446,9 +446,10 @@ impl AcpThreadHistory { .tooltip(move |_window, cx| { Tooltip::for_action("Delete", &RemoveSelectedThread, cx) }) - .on_click( - cx.listener(move |this, _, _, cx| this.remove_thread(ix, cx)), - ), + .on_click(cx.listener(move |this, _, _, cx| { + this.remove_thread(ix, cx); + cx.stop_propagation() + })), ) } else { None