Skip to content

Commit d23cad2

Browse files
committed
fix(agent): Ensure context meter updates when context is cleared
1 parent b4fbb9b commit d23cad2

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

crates/agent/src/active_thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,7 @@ impl ActiveThread {
14631463
_window: &mut Window,
14641464
cx: &mut Context<Self>,
14651465
) {
1466-
self.context_store.update(cx, |store, _cx| store.clear());
1466+
self.context_store.update(cx, |store, cx| store.clear(cx));
14671467
cx.notify();
14681468
}
14691469

crates/agent/src/context_store.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@ impl ContextStore {
5858
self.context_set.iter().map(|entry| entry.as_ref())
5959
}
6060

61-
pub fn clear(&mut self) {
61+
pub fn clear(&mut self, cx: &mut Context<Self>) {
6262
self.context_set.clear();
6363
self.context_thread_ids.clear();
64+
cx.notify();
6465
}
6566

6667
pub fn new_context_for_thread(

crates/agent/src/inline_prompt_editor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ impl<T: 'static> PromptEditor<T> {
373373
_window: &mut Window,
374374
cx: &mut Context<Self>,
375375
) {
376-
self.context_store.update(cx, |store, _cx| store.clear());
376+
self.context_store.update(cx, |store, cx| store.clear(cx));
377377
cx.notify();
378378
}
379379

crates/agent/src/message_editor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ impl MessageEditor {
272272
_window: &mut Window,
273273
cx: &mut Context<Self>,
274274
) {
275-
self.context_store.update(cx, |store, _cx| store.clear());
275+
self.context_store.update(cx, |store, cx| store.clear(cx));
276276
cx.notify();
277277
}
278278

0 commit comments

Comments
 (0)