Fix native agent thread history notify refresh (#47733)
Release Notes: - N/A
This commit is contained in:
1 parent
75a2b4321b
commit
4ea3a839e1
1 file changed
+12
-1
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user