This commit is contained in:
2026-07-29 11:15:42 +07:00
parent ef7698d248
commit 5945251a60
4 changed files with 32 additions and 14 deletions

View File

@@ -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();
}),
);

View File

@@ -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);
});
});