forge
Explore
Log in

Don't you dare go Hollow

User dropdown client list keeps polling across builder tab switches while the dropdown stays open

Browse files at this commit

e541d6983b288c4ae64e17a5db99fd8bdcd61e2aAhmet Kaan GümüşParent: 755029a
  • fix
    • user dropdown client list keeps polling across builder tab switches while the dropdown stays open
Show full message
🐛 fix: user dropdown client list keeps polling across builder tab switches while the dropdown stays open
crates/client/src/gui/builder/users.rsmodified+6 -9
@@ -269,16 +269,13 @@ impl Yumush {
269 let network = self.network.clone();269 let network = self.network.clone();
270 self.chat.builder_clients_task = Some(cx.spawn(async move |this, cx| {270 self.chat.builder_clients_task = Some(cx.spawn(async move |this, cx| {
271 loop {271 loop {
272- let open = this272+ let Ok(visible) = this.update(cx, |yumush, _| {
273- .update(cx, |yumush, _| {273+ yumush.chat.view == View::Builder
274- yumush.chat.view == View::Builder274+ && yumush.chat.builder_tab == BuilderTab::Users
275- && yumush.chat.builder_tab == BuilderTab::Users275+ }) else {
276- })
277- .unwrap_or(false);
278- if !open {
279 break;276 break;
280- }277+ };
281- if let Ok(clients) = network.call(ListUpdateClients { user_id }).await {278+ if visible && let Ok(clients) = network.call(ListUpdateClients { user_id }).await {
282 let _ = this.update(cx, |yumush, cx| {279 let _ = this.update(cx, |yumush, cx| {
283 yumush.chat.builder_clients = clients;280 yumush.chat.builder_clients = clients;
284 cx.notify();281 cx.notify();