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:
parent
d1dd8ffcd9
commit
000745592a
@ -46,7 +46,7 @@ export function VoiceSettingsOverlay({
|
|||||||
const [voiceId, setVoiceId] = useState("");
|
const [voiceId, setVoiceId] = useState("");
|
||||||
const [autoSpeak, setAutoSpeak] = useState(false);
|
const [autoSpeak, setAutoSpeak] = useState(false);
|
||||||
const [loading, setLoading] = useState(true);
|
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 [error, setError] = useState<string | null>(null);
|
||||||
const [notice, setNotice] = useState<string | null>(null);
|
const [notice, setNotice] = useState<string | null>(null);
|
||||||
const [soundEnabled, setSoundEnabled] = useState(() => readOoSoundEnabled());
|
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);
|
setPending(next);
|
||||||
onBusyChange?.(next !== null);
|
onBusyChange?.(next !== null);
|
||||||
}
|
}
|
||||||
@ -129,8 +129,6 @@ export function VoiceSettingsOverlay({
|
|||||||
|
|
||||||
async function ensureLocalVoice(): Promise<boolean> {
|
async function ensureLocalVoice(): Promise<boolean> {
|
||||||
if (localConnected) return true;
|
if (localConnected) return true;
|
||||||
markPending("connect");
|
|
||||||
setError(null);
|
|
||||||
try {
|
try {
|
||||||
await rpc.voice.connect({
|
await rpc.voice.connect({
|
||||||
provider: LOCAL_PROVIDER_ID,
|
provider: LOCAL_PROVIDER_ID,
|
||||||
@ -145,8 +143,6 @@ export function VoiceSettingsOverlay({
|
|||||||
}
|
}
|
||||||
setError(err instanceof Error ? err.message : t`Could not enable speaking`);
|
setError(err instanceof Error ? err.message : t`Could not enable speaking`);
|
||||||
return false;
|
return false;
|
||||||
} finally {
|
|
||||||
markPending(null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user