mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-24 17:28:40 +00:00
Avoid spurious notifies in chat channel select
Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
1d5b665f13
commit
84c4db13fb
1 changed files with 9 additions and 5 deletions
|
@ -53,8 +53,10 @@ impl Select {
|
|||
}
|
||||
|
||||
pub fn set_item_count(&mut self, count: usize, cx: &mut ViewContext<Self>) {
|
||||
self.item_count = count;
|
||||
cx.notify();
|
||||
if count != self.item_count {
|
||||
self.item_count = count;
|
||||
cx.notify();
|
||||
}
|
||||
}
|
||||
|
||||
fn toggle(&mut self, cx: &mut ViewContext<Self>) {
|
||||
|
@ -63,9 +65,11 @@ impl Select {
|
|||
}
|
||||
|
||||
pub fn set_selected_index(&mut self, ix: usize, cx: &mut ViewContext<Self>) {
|
||||
self.selected_item_ix = ix;
|
||||
self.is_open = false;
|
||||
cx.notify();
|
||||
if ix != self.selected_item_ix || self.is_open {
|
||||
self.selected_item_ix = ix;
|
||||
self.is_open = false;
|
||||
cx.notify();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn selected_index(&self) -> usize {
|
||||
|
|
Loading…
Reference in a new issue