Skip to content

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

fix: move useEffect after reasoningProvider definition to fix settings page crash

Gabriel Stein40e7046882da
diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.ts
index 8a5dd0011..a344e132c 100644
--- a/src/hooks/useSettings.ts
+++ b/src/hooks/useSettings.ts
@@ -288,29 +288,6 @@ export function useSettings() {
}
}, 1000);
- // Sync startup pre-warming preferences to main process
- useEffect(() => {
- if (typeof window === "undefined" || !window.electronAPI?.syncStartupPreferences) return;
-
- const model = localTranscriptionProvider === "nvidia" ? parakeetModel : whisperModel;
- window.electronAPI
- .syncStartupPreferences({
- useLocalWhisper,
- localTranscriptionProvider,
- model: model || undefined,
- reasoningProvider,
- reasoningModel: reasoningProvider === "local" ? reasoningModel : undefined,
- })
- .catch((err) => console.error("Failed to sync startup preferences:", err));
- }, [
- useLocalWhisper,
- localTranscriptionProvider,
- whisperModel,
- parakeetModel,
- reasoningProvider,
- reasoningModel,
- ]);
-
// Wrapped setters that sync to Electron IPC and invalidate cache
const setOpenaiApiKey = useCallback(
(key: string) => {
@@ -424,6 +401,29 @@ export function useSettings() {
// Computed values
const reasoningProvider = getModelProvider(reasoningModel);
+ // Sync startup pre-warming preferences to main process
+ useEffect(() => {
+ if (typeof window === "undefined" || !window.electronAPI?.syncStartupPreferences) return;
+
+ const model = localTranscriptionProvider === "nvidia" ? parakeetModel : whisperModel;
+ window.electronAPI
+ .syncStartupPreferences({
+ useLocalWhisper,
+ localTranscriptionProvider,
+ model: model || undefined,
+ reasoningProvider,
+ reasoningModel: reasoningProvider === "local" ? reasoningModel : undefined,
+ })
+ .catch((err) => console.error("Failed to sync startup preferences:", err));
+ }, [
+ useLocalWhisper,
+ localTranscriptionProvider,
+ whisperModel,
+ parakeetModel,
+ reasoningProvider,
+ reasoningModel,
+ ]);
+
// Batch operations
const updateTranscriptionSettings = useCallback(
(settings: Partial<TranscriptionSettings>) => {