diff --git a/zed/src/people_panel.rs b/zed/src/people_panel.rs index 7d935c714e05ff17015d0f2cb42642d6523ffe69..fc459825de043f3a7f96f759cc385d31e6117502 100644 --- a/zed/src/people_panel.rs +++ b/zed/src/people_panel.rs @@ -1,17 +1,18 @@ -use gpui::{ - elements::*, Element, ElementBox, Entity, ModelHandle, RenderContext, View, ViewContext, -}; -use postage::watch; - use crate::{ theme::Theme, user::{Collaborator, UserStore}, Settings, }; +use gpui::{ + elements::*, Element, ElementBox, Entity, ModelHandle, RenderContext, Subscription, View, + ViewContext, +}; +use postage::watch; pub struct PeoplePanel { collaborators: ListState, user_store: ModelHandle, + _maintain_collaborators: Subscription, } impl PeoplePanel { @@ -20,7 +21,6 @@ impl PeoplePanel { settings: watch::Receiver, cx: &mut ViewContext, ) -> Self { - cx.observe(&user_store, Self::update_collaborators); Self { collaborators: ListState::new( user_store.read(cx).collaborators().len(), @@ -35,6 +35,7 @@ impl PeoplePanel { } }, ), + _maintain_collaborators: cx.observe(&user_store, Self::update_collaborators), user_store, } } @@ -108,7 +109,7 @@ impl View for PeoplePanel { "PeoplePanel" } - fn render(&mut self, cx: &mut RenderContext) -> ElementBox { + fn render(&mut self, _: &mut RenderContext) -> ElementBox { List::new(self.collaborators.clone()).boxed() } }