Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Refactor mic input selection logic in set_mic_input
Richie McIlroy2225a86613f8
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rsindex d8329e683..b2152ba35 100644--- a/apps/desktop/src-tauri/src/lib.rs+++ b/apps/desktop/src-tauri/src/lib.rs@@ -236,13 +236,10 @@ impl App {#[specta::specta]#[instrument(skip(state))]async fn set_mic_input(state: MutableState<'_, App>, label: Option<String>) -> Result<(), String> {- let mic_feed = {- let mut app = state.write().await;- app.selected_mic_label = label.clone();- app.mic_feed.clone()- };+ let mic_feed = state.read().await.mic_feed.clone();+ let desired_label = label.clone();- match label {+ match desired_label.as_ref() {None => {mic_feed.ask(microphone::RemoveInput)@@ -251,7 +248,9 @@ async fn set_mic_input(state: MutableState<'_, App>, label: Option<String>) -> R}Some(label) => {mic_feed- .ask(feeds::microphone::SetInput { label })+ .ask(feeds::microphone::SetInput {+ label: label.clone(),+ }).await.map_err(|e| e.to_string())?.await@@ -259,6 +258,11 @@ async fn set_mic_input(state: MutableState<'_, App>, label: Option<String>) -> R}}+ {+ let mut app = state.write().await;+ app.selected_mic_label = desired_label;+ }+Ok(())}