Keep voice choices locked until speaking finishes turning on (#220)

Turning speaking on connected the local voice and cleared the busy
state halfway through, so a voice picked in that window was replaced by
the default once the switch finished. The panel now stays busy for the
whole switch.


Claude-Session: https://claude.ai/code/session_01Wy1md9QE1ayJbDCwJ4vAQs

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
cynarAI 2026-10-20 11:14:28 +02:00 committed by GitHub
parent d1dd8ffcd9
commit 000745592a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -46,7 +46,7 @@ export function VoiceSettingsOverlay({
const [voiceId, setVoiceId] = useState("");
const [autoSpeak, setAutoSpeak] = useState(false);
const [loading, setLoading] = useState(true);
const [pending, setPending] = useState<"connect" | "voice" | "speak" | null>(null);
const [pending, setPending] = useState<"voice" | "speak" | null>(null);
const [error, setError] = useState<string | null>(null);
const [notice, setNotice] = useState<string | null>(null);
const [soundEnabled, setSoundEnabled] = useState(() => readOoSoundEnabled());
@ -74,7 +74,7 @@ export function VoiceSettingsOverlay({
};
}, []);
function markPending(next: "connect" | "voice" | "speak" | null) {
function markPending(next: "voice" | "speak" | null) {
setPending(next);
onBusyChange?.(next !== null);
}
@ -129,8 +129,6 @@ export function VoiceSettingsOverlay({
async function ensureLocalVoice(): Promise<boolean> {
if (localConnected) return true;
markPending("connect");
setError(null);
try {
await rpc.voice.connect({
provider: LOCAL_PROVIDER_ID,
@ -145,8 +143,6 @@ export function VoiceSettingsOverlay({
}
setError(err instanceof Error ? err.message : t`Could not enable speaking`);
return false;
} finally {
markPending(null);
}
}