Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix native agent thread history notify refresh (#47733)

Joseph T. Lyons969fb8fe03d6
diff --git a/crates/agent/src/agent.rs b/crates/agent/src/agent.rs
index 9aa7657f628..d8d2f4d3a74 100644
--- a/crates/agent/src/agent.rs
+++ b/crates/agent/src/agent.rs
@@ -1399,6 +1399,7 @@ impl acp_thread::AgentTelemetry for NativeAgentConnection {
pub struct NativeAgentSessionList {
thread_store: Entity<ThreadStore>,
+ updates_tx: smol::channel::Sender<acp_thread::SessionListUpdate>,
updates_rx: smol::channel::Receiver<acp_thread::SessionListUpdate>,
_subscription: Subscription,
}
@@ -1406,11 +1407,15 @@ pub struct NativeAgentSessionList {
impl NativeAgentSessionList {
fn new(thread_store: Entity<ThreadStore>, cx: &mut App) -> Self {
let (tx, rx) = smol::channel::unbounded();
+ let this_tx = tx.clone();
let subscription = cx.observe(&thread_store, move |_, _| {
- tx.try_send(acp_thread::SessionListUpdate::Refresh).ok();
+ this_tx
+ .try_send(acp_thread::SessionListUpdate::Refresh)
+ .ok();
});
Self {
thread_store,
+ updates_tx: tx,
updates_rx: rx,
_subscription: subscription,
}
@@ -1467,6 +1472,12 @@ impl AgentSessionList for NativeAgentSessionList {
Some(self.updates_rx.clone())
}
+ fn notify_refresh(&self) {
+ self.updates_tx
+ .try_send(acp_thread::SessionListUpdate::Refresh)
+ .ok();
+ }
+
fn into_any(self: Rc<Self>) -> Rc<dyn Any> {
self
}