fix
This commit is contained in:
@@ -221,13 +221,23 @@ impl Workspace {
|
||||
);
|
||||
|
||||
subscriptions.push(
|
||||
// Observe the chat registry
|
||||
// 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);
|
||||
|
||||
chat.update(cx, |this, cx| {
|
||||
this.refresh_rooms(&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();
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
@@ -329,7 +329,7 @@ impl Sidebar {
|
||||
.organize(&public_key)
|
||||
.kind(RoomKind::Ongoing)
|
||||
});
|
||||
this.emit_room(&room, cx);
|
||||
this.emit_room(&room, _window, cx);
|
||||
})?;
|
||||
|
||||
// Reset the find panel
|
||||
@@ -373,9 +373,9 @@ impl Sidebar {
|
||||
let room = item.read(cx);
|
||||
let room_clone = item.clone();
|
||||
let public_key = room.display_member(cx).public_key();
|
||||
let handler = cx.listener(move |_this, _ev, _window, cx| {
|
||||
let handler = cx.listener(move |_this, _ev, window, cx| {
|
||||
ChatRegistry::global(cx).update(cx, |s, cx| {
|
||||
s.emit_room(&room_clone, cx);
|
||||
s.emit_room(&room_clone, window, cx);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user