diff --git a/src/renderer/src/components/dictation/speech-model-update-check.ts b/src/renderer/src/components/dictation/speech-model-update-check.ts index c847061edca..8f11c721f80 100644 --- a/src/renderer/src/components/dictation/speech-model-update-check.ts +++ b/src/renderer/src/components/dictation/speech-model-update-check.ts @@ -13,7 +13,11 @@ export function loadSpeechCatalog(): Promise { catalogRequest ??= Promise.resolve() // The paired web client's fallback resolves with nothing rather than a list. .then(async () => (await window.api.speech.getCatalog()) ?? []) - .catch(() => []) + .catch(() => { + // Not cached, so the next press asks again. + catalogRequest = null + return [] + }) return catalogRequest } @@ -35,7 +39,8 @@ export async function checkSpeechModelUpdate( ]) useAppStore.getState().setModelStates(states) const target = findSpeechModelUpdateTarget(voice, catalog, states) - if (!target) { + // An empty catalog proves nothing, so it isn't remembered as up to date. + if (!target && catalog.length > 0) { upToDateModelIds.add(voice.sttModel) } return target diff --git a/src/renderer/src/components/dictation/use-dictation-speech-model-setup.ts b/src/renderer/src/components/dictation/use-dictation-speech-model-setup.ts index d6c3affc3aa..6206e75287b 100644 --- a/src/renderer/src/components/dictation/use-dictation-speech-model-setup.ts +++ b/src/renderer/src/components/dictation/use-dictation-speech-model-setup.ts @@ -30,6 +30,9 @@ export function useDictationSpeechModelSetup( async (voice: Pick): Promise => { const request = ++startRequestRef.current const target = await checkSpeechModelUpdate(voice) + if (request !== startRequestRef.current) { + return false + } if (target) { if (isIdle()) { setPillAnchor(dictationPillAnchorFor(captureInsertionTarget())) @@ -37,9 +40,6 @@ export function useDictationSpeechModelSetup( } return false } - if (request !== startRequestRef.current) { - return false - } setSetupTarget(null) return true }, diff --git a/src/renderer/src/components/dictation/use-speech-model-update-download.ts b/src/renderer/src/components/dictation/use-speech-model-update-download.ts index 7816689c596..4241dc18d1d 100644 --- a/src/renderer/src/components/dictation/use-speech-model-update-download.ts +++ b/src/renderer/src/components/dictation/use-speech-model-update-download.ts @@ -53,7 +53,10 @@ export function useSpeechModelUpdateDownload( } const cancel = (): void => { - void window.api.speech.cancelDownload(model.id).finally(() => void refreshModelStates()) + void window.api.speech + .cancelDownload(model.id) + .catch(() => undefined) + .finally(() => void refreshModelStates()) } const deleteRetired = (): void => {