From 54cbd98781368a24173100c91e5f15a496233f20 Mon Sep 17 00:00:00 2001 From: Alex P Date: Thu, 23 Oct 2025 23:59:02 +0300 Subject: [PATCH] fix: verify audio source change and show accurate feedback After setting audio output source, fetch the actual value from backend to verify the change was applied successfully. This prevents the UI from showing incorrect state when the backend fails to apply the change. The optimistic update provides immediate feedback, but we now verify the actual result and show error if backend returned a different value than expected. --- ui/src/routes/devices.$id.settings.audio.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ui/src/routes/devices.$id.settings.audio.tsx b/ui/src/routes/devices.$id.settings.audio.tsx index 2a242c22..22a47277 100644 --- a/ui/src/routes/devices.$id.settings.audio.tsx +++ b/ui/src/routes/devices.$id.settings.audio.tsx @@ -56,7 +56,21 @@ export default function SettingsAudioRoute() { ); return; } - notifications.success(m.audio_settings_output_source_success()); + + // Verify the change was applied by fetching the actual value + send("getAudioOutputSource", {}, (getResp: JsonRpcResponse) => { + if ("result" in getResp) { + const actualSource = getResp.result as string; + settings.setAudioOutputSource(actualSource); + if (actualSource === source) { + notifications.success(m.audio_settings_output_source_success()); + } else { + notifications.error( + m.audio_settings_output_source_failed({ error: `Expected ${source}, got ${actualSource}` }), + ); + } + } + }); }); };