mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-27 10:59:53 +00:00
Set room only after project has been shared to avoid flicker
This commit is contained in:
parent
84eebbe24a
commit
78e3370c1e
1 changed files with 14 additions and 12 deletions
|
@ -50,9 +50,7 @@ impl ActiveCall {
|
|||
let room = if let Some(room) = room {
|
||||
room
|
||||
} else {
|
||||
let room = cx.update(|cx| Room::create(client, user_store, cx)).await?;
|
||||
this.update(&mut cx, |this, cx| this.set_room(Some(room.clone()), cx));
|
||||
room
|
||||
cx.update(|cx| Room::create(client, user_store, cx)).await?
|
||||
};
|
||||
|
||||
let initial_project_id = if let Some(initial_project) = initial_project {
|
||||
|
@ -65,6 +63,8 @@ impl ActiveCall {
|
|||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
this.update(&mut cx, |this, cx| this.set_room(Some(room.clone()), cx));
|
||||
room.update(&mut cx, |room, cx| {
|
||||
room.call(recipient_user_id, initial_project_id, cx)
|
||||
})
|
||||
|
@ -88,6 +88,7 @@ impl ActiveCall {
|
|||
}
|
||||
|
||||
fn set_room(&mut self, room: Option<ModelHandle<Room>>, cx: &mut ModelContext<Self>) {
|
||||
if room.as_ref() != self.room.as_ref().map(|room| &room.0) {
|
||||
if let Some(room) = room {
|
||||
let subscriptions = vec![
|
||||
cx.observe(&room, |_, _, cx| cx.notify()),
|
||||
|
@ -99,6 +100,7 @@ impl ActiveCall {
|
|||
}
|
||||
cx.notify();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn room(&self) -> Option<&ModelHandle<Room>> {
|
||||
self.room.as_ref().map(|(room, _)| room)
|
||||
|
|
Loading…
Reference in a new issue