From 9d2b7c80336f1387aaef8c000148406e428671ae Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Thu, 10 Jul 2025 16:45:17 -0300 Subject: [PATCH] agent: Dismiss the agent panel notification if window is closed (#34230) Closes https://github.com/zed-industries/zed/issues/32951 Release Notes: - agent: Fixed an issue where the agent panel notification would linger on even after you closed the window. --- crates/agent_ui/src/active_thread.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/agent_ui/src/active_thread.rs b/crates/agent_ui/src/active_thread.rs index e8651e0c5f..383729017a 100644 --- a/crates/agent_ui/src/active_thread.rs +++ b/crates/agent_ui/src/active_thread.rs @@ -787,6 +787,15 @@ impl ActiveThread { .unwrap() } }); + + let workspace_subscription = if let Some(workspace) = workspace.upgrade() { + Some(cx.observe_release(&workspace, |this, _, cx| { + this.dismiss_notifications(cx); + })) + } else { + None + }; + let mut this = Self { language_registry, thread_store, @@ -834,6 +843,10 @@ impl ActiveThread { } } + if let Some(subscription) = workspace_subscription { + this._subscriptions.push(subscription); + } + this }