Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix: retry STT config fetch before recording when auth isn't ready on mount

Gabriel Steind21865aceae2
diff --git a/src/hooks/useAudioRecording.js b/src/hooks/useAudioRecording.js
index 774589b10..cbe486dff 100644
--- a/src/hooks/useAudioRecording.js
+++ b/src/hooks/useAudioRecording.js
@@ -27,6 +27,14 @@ export const useAudioRecording = (toast, options = {}) => {
const currentState = audioManagerRef.current.getState();
if (currentState.isRecording || currentState.isProcessing) return false;
+ // Retry STT config fetch if it wasn't loaded on mount (e.g. auth wasn't ready)
+ if (!audioManagerRef.current.sttConfig) {
+ const config = await window.electronAPI.getSttConfig?.();
+ if (config?.success) {
+ audioManagerRef.current.setSttConfig(config);
+ }
+ }
+
const didStart = audioManagerRef.current.shouldUseStreaming()
? await audioManagerRef.current.startStreamingRecording()
: await audioManagerRef.current.startRecording();
@@ -159,7 +167,7 @@ export const useAudioRecording = (toast, options = {}) => {
audioManagerRef.current.setContext("dictation");
window.electronAPI.getSttConfig?.().then((config) => {
- if (config && audioManagerRef.current) {
+ if (config?.success && audioManagerRef.current) {
audioManagerRef.current.setSttConfig(config);
if (audioManagerRef.current.shouldUseStreaming()) {
audioManagerRef.current.warmupStreamingConnection();
diff --git a/src/hooks/useNoteRecording.ts b/src/hooks/useNoteRecording.ts
index f5cfa8378..5acb8e6dd 100644
--- a/src/hooks/useNoteRecording.ts
+++ b/src/hooks/useNoteRecording.ts
@@ -107,7 +107,7 @@ export function useNoteRecording({
manager.setContext("notes");
window.electronAPI.getSttConfig?.().then((config) => {
- if (config && audioManagerRef.current) {
+ if (config?.success && audioManagerRef.current) {
audioManagerRef.current.setSttConfig(config);
if (manager.shouldUseStreaming()) {
manager.warmupStreamingConnection();
@@ -132,6 +132,14 @@ export function useNoteRecording({
const state = manager.getState();
if (state.isRecording || state.isProcessing) return;
+ // Retry STT config fetch if it wasn't loaded on mount (e.g. auth wasn't ready)
+ if (!manager.sttConfig) {
+ const config = await window.electronAPI.getSttConfig?.();
+ if (config?.success) {
+ manager.setSttConfig(config);
+ }
+ }
+
const didStart = manager.shouldUseStreaming()
? await manager.startStreamingRecording()
: await manager.startRecording();