From b0d9e3c8fad09e62fc07d3aef9ec75c5b78dd9c9 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Mon, 27 Nov 2023 21:44:53 +0100 Subject: [PATCH] Await toggle of mute --- crates/call2/src/call2.rs | 7 +++++-- crates/call2/src/room.rs | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/call2/src/call2.rs b/crates/call2/src/call2.rs index 9a89ec7167..7885ef6e3f 100644 --- a/crates/call2/src/call2.rs +++ b/crates/call2/src/call2.rs @@ -660,9 +660,12 @@ impl CallHandler for Call { self.active_call.as_ref().map(|call| { call.0.update(cx, |this, cx| { this.room().map(|room| { - room.update(cx, |this, cx| { - this.toggle_mute(cx).log_err(); + let room = room.clone(); + cx.spawn(|_, mut cx| async move { + room.update(&mut cx, |this, cx| this.toggle_mute(cx))?? + .await }) + .detach_and_log_err(cx); }) }) }); diff --git a/crates/call2/src/room.rs b/crates/call2/src/room.rs index e54455a87e..d091f801f8 100644 --- a/crates/call2/src/room.rs +++ b/crates/call2/src/room.rs @@ -1268,7 +1268,6 @@ impl Room { .ok_or_else(|| anyhow!("live-kit was not initialized"))? .await }; - let publication = publish_track.await; this.upgrade() .ok_or_else(|| anyhow!("room was dropped"))?