.
This commit is contained in:
@@ -220,27 +220,6 @@ impl Workspace {
|
||||
}),
|
||||
);
|
||||
|
||||
subscriptions.push(
|
||||
// Observe the chat registry.
|
||||
// Deferred via spawn to avoid potential re-entrancy if
|
||||
// cx.observe fires synchronously during a chat.update.
|
||||
cx.observe(&chat, move |this, chat, cx| {
|
||||
let ids = this.panel_ids(cx);
|
||||
let chat = chat.downgrade();
|
||||
cx.spawn(async move |this, cx| -> anyhow::Result<()> {
|
||||
if let Some(chat) = chat.upgrade() {
|
||||
this.update(cx, |_this, cx| {
|
||||
chat.update(cx, |chat, cx| {
|
||||
chat.refresh_rooms(&ids, cx);
|
||||
});
|
||||
})?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.detach();
|
||||
}),
|
||||
);
|
||||
|
||||
cx.defer_in(window, |this, window, cx| {
|
||||
let dock = this.dock.downgrade();
|
||||
let greeter = Arc::new(greeter::init(window, cx));
|
||||
@@ -277,17 +256,6 @@ impl Workspace {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get all panel ids
|
||||
fn panel_ids(&self, cx: &App) -> Vec<u64> {
|
||||
self.dock
|
||||
.read(cx)
|
||||
.items
|
||||
.panel_ids(cx)
|
||||
.into_iter()
|
||||
.filter_map(|panel| panel.parse::<u64>().ok())
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Handle command events
|
||||
fn on_command(&mut self, command: &Command, window: &mut Window, cx: &mut Context<Self>) {
|
||||
match command {
|
||||
|
||||
Reference in New Issue
Block a user