fix(player): don't report a successful stereo-pair mutation as failed

refreshDevices() now throws on a failed /api/devices fetch (needed by
removeDeviceAndRefresh's success/failure contract), but StereoPair's
run() awaited it inside the same try that already notified success --
so a refresh/device-list-fetch hiccup after a successful create/rename/
dissolve rolled the UI back into an "operation failed" error state even
though the mutation itself succeeded. Isolate the post-success refresh
so its failure only surfaces as its own, separate notice.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Tobias Gesellchen
2026-09-05 17:30:23 +02:00
co-authored by Claude Sonnet 5
parent 4cb6044259
commit 268a7f7ac8
@@ -163,8 +163,15 @@ export function StereoPair({ deviceId, device, devices, onChanged, notify }) {
setShowPicker(false);
onSuccess?.();
notify?.(successMessage);
await onChanged?.();
await refresh();
try {
await onChanged?.();
await refresh();
} catch (_) {
// The mutation itself already succeeded and was notified
// above; a failure here only means the device list/local
// view didn't refresh, not that the operation failed.
notify?.('Stereo pair updated, but the device list failed to refresh');
}
} catch (_) {
if (isCurrentMutation()) {
await recoverFromFailure('Stereo-pair operation failed');