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