diff --git a/crates/client/src/user.rs b/crates/client/src/user.rs index a8de7a082d..13439c6893 100644 --- a/crates/client/src/user.rs +++ b/crates/client/src/user.rs @@ -376,9 +376,17 @@ impl UserStore { &mut self, mut user_ids: Vec, cx: &mut ModelContext, - ) -> Task>>> { + ) -> Task> { user_ids.retain(|id| !self.users.contains_key(id)); - self.load_users(proto::GetUsers { user_ids }, cx) + if user_ids.is_empty() { + Task::ready(Ok(())) + } else { + let load = self.load_users(proto::GetUsers { user_ids }, cx); + cx.foreground().spawn(async move { + load.await?; + Ok(()) + }) + } } pub fn fuzzy_search_users(