From a1a94371f4d292a5dffc589fd1a5e0b9e1a850b1 Mon Sep 17 00:00:00 2001 From: Liet Blue <127093491+lietblue@users.noreply.github.com> Date: Fri, 13 Mar 2026 22:38:54 +0800 Subject: [PATCH] fix(speech): prevent speech provider config reset on startup by removing premature immediate watcher (#1340) --- packages/stage-ui/src/stores/modules/speech.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/stage-ui/src/stores/modules/speech.ts b/packages/stage-ui/src/stores/modules/speech.ts index 404db8799..6d82bb6df 100644 --- a/packages/stage-ui/src/stores/modules/speech.ts +++ b/packages/stage-ui/src/stores/modules/speech.ts @@ -136,6 +136,10 @@ export const useSpeechStore = defineStore('speech', () => { // NOTICE: clear stale selection when the currently selected speech provider // is no longer configured to avoid implicit fallback behavior from persisted state. + // NOTE: Do NOT use { immediate: true } here — providers.ts validates credentials + // asynchronously on startup, so firing immediately would see an empty + // configuredSpeechProvidersMetadata and incorrectly reset activeSpeechProvider + // to 'speech-noop', permanently wiping the persisted selection from localStorage. if (!configuredProviderIds.includes(activeSpeechProvider.value)) { activeSpeechProvider.value = 'speech-noop' activeSpeechModel.value = '' @@ -143,8 +147,6 @@ export const useSpeechStore = defineStore('speech', () => { activeSpeechVoice.value = undefined } }, - - { immediate: true }, ) onMounted(() => {