Skip to content

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

fix(settings): preserve download progress across tab switches (#735)

Alcahest3b0ac975b960
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx
index a2a652342..698374251 100644
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@ -494,6 +494,10 @@ function VADLabelWithInfo({ label, description }: { label: string; description:
);
}
+function TabPanel({ active, children }: { active: boolean; children: React.ReactNode }) {
+ return <div className={active ? undefined : "hidden"}>{children}</div>;
+}
+
function SpeechToTextTabs({
initialTab,
renderDictation,
@@ -529,7 +533,8 @@ function SpeechToTextTabs({
)
}
/>
- {tab === "dictation" ? renderDictation() : renderNoteRecording()}
+ <TabPanel active={tab === "dictation"}>{renderDictation()}</TabPanel>
+ <TabPanel active={tab === "noteRecording"}>{renderNoteRecording()}</TabPanel>
</div>
);
}
@@ -574,10 +579,10 @@ function LlmsTabs({
return <MessageSquare className="w-3.5 h-3.5" />;
}}
/>
- {tab === "dictationCleanup" && renderDictationCleanup()}
- {tab === "dictationAgent" && renderDictationAgent()}
- {tab === "noteFormatting" && renderNoteFormatting()}
- {tab === "chatIntelligence" && renderChatIntelligence()}
+ <TabPanel active={tab === "dictationCleanup"}>{renderDictationCleanup()}</TabPanel>
+ <TabPanel active={tab === "dictationAgent"}>{renderDictationAgent()}</TabPanel>
+ <TabPanel active={tab === "noteFormatting"}>{renderNoteFormatting()}</TabPanel>
+ <TabPanel active={tab === "chatIntelligence"}>{renderChatIntelligence()}</TabPanel>
</div>
);
}
@@ -807,6 +812,21 @@ export default function SettingsPage({
.catch(() => {});
}, [activeSection]);
+ // Lazy keep-alive: mount AI sections only after the user has visited them once,
+ // then keep them mounted so model-download progress and IPC listeners survive
+ // section switches. The setState-during-render pattern flips the flag in the
+ // same commit as the section change, so there's no blank frame on first visit.
+ const [hasMountedSpeechToText, setHasMountedSpeechToText] = useState(
+ activeSection === "speechToText"
+ );
+ const [hasMountedLlms, setHasMountedLlms] = useState(activeSection === "llms");
+ if (activeSection === "speechToText" && !hasMountedSpeechToText) {
+ setHasMountedSpeechToText(true);
+ }
+ if (activeSection === "llms" && !hasMountedLlms) {
+ setHasMountedLlms(true);
+ }
+
const handleClearAllAudio = async () => {
if (!window.electronAPI?.deleteAllAudio) return;
try {
@@ -3206,83 +3226,8 @@ EOF`,
);
case "speechToText":
- return (
- <SpeechToTextTabs
- initialTab={initialSubTab as SpeechTab | undefined}
- renderDictation={() => (
- <div className="space-y-6">
- <TranscriptionSection
- isSignedIn={isSignedIn ?? false}
- startOnboarding={startOnboarding}
- cloudTranscriptionMode={cloudTranscriptionMode}
- setCloudTranscriptionMode={setCloudTranscriptionMode}
- useLocalWhisper={useLocalWhisper}
- setUseLocalWhisper={setUseLocalWhisper}
- updateTranscriptionSettings={updateTranscriptionSettings}
- cloudTranscriptionProvider={cloudTranscriptionProvider}
- setCloudTranscriptionProvider={setCloudTranscriptionProvider}
- cloudTranscriptionModel={cloudTranscriptionModel}
- setCloudTranscriptionModel={setCloudTranscriptionModel}
- localTranscriptionProvider={localTranscriptionProvider}
- setLocalTranscriptionProvider={setLocalTranscriptionProvider}
- whisperModel={whisperModel}
- setWhisperModel={setWhisperModel}
- parakeetModel={parakeetModel}
- setParakeetModel={setParakeetModel}
- cloudTranscriptionBaseUrl={cloudTranscriptionBaseUrl}
- setCloudTranscriptionBaseUrl={setCloudTranscriptionBaseUrl}
- transcriptionMode={transcriptionMode}
- setTranscriptionMode={setTranscriptionMode}
- remoteTranscriptionUrl={remoteTranscriptionUrl}
- setRemoteTranscriptionUrl={setRemoteTranscriptionUrl}
- showTranscriptionPreview={showTranscriptionPreview}
- setShowTranscriptionPreview={setShowTranscriptionPreview}
- toast={toast}
- />
- {transcriptionMode === "local" &&
- localTranscriptionProvider !== "nvidia" &&
- renderWhisperVadSettings()}
- </div>
- )}
- renderNoteRecording={() => (
- <div className="space-y-6">
- <MeetingTranscriptionPanel />
- {transcriptionMode === "local" &&
- localTranscriptionProvider !== "nvidia" &&
- renderWhisperVadSettings()}
- </div>
- )}
- />
- );
-
case "llms":
- return (
- <LlmsTabs
- initialTab={initialSubTab as LlmTab | undefined}
- renderChatIntelligence={() => <ChatAgentSettings />}
- renderDictationCleanup={() => (
- <div className="space-y-6">
- <AiModelsSection
- useCleanupModel={useCleanupModel}
- setUseCleanupModel={(value) => {
- updateCleanupSettings({ useCleanupModel: value });
- }}
- toast={toast}
- />
-
- <div className="border-t border-border/40 pt-6">
- <SectionHeader
- title={t("settingsPage.prompts.title")}
- description={t("settingsPage.prompts.description")}
- />
- <PromptStudio />
- </div>
- </div>
- )}
- renderDictationAgent={() => <DictationAgentSettings />}
- renderNoteFormatting={() => <NoteFormattingSettings />}
- />
- );
+ return null;
case "privacyData":
return (
@@ -3852,6 +3797,91 @@ EOF`,
onOk={() => {}}
/>
+ {/* Mounted on first visit and kept alive so model-download progress and IPC listeners survive section switches. */}
+ {hasMountedSpeechToText && (
+ <TabPanel active={activeSection === "speechToText"}>
+ <SpeechToTextTabs
+ initialTab={
+ activeSection === "speechToText"
+ ? (initialSubTab as SpeechTab | undefined)
+ : undefined
+ }
+ renderDictation={() => (
+ <div className="space-y-6">
+ <TranscriptionSection
+ isSignedIn={isSignedIn ?? false}
+ startOnboarding={startOnboarding}
+ cloudTranscriptionMode={cloudTranscriptionMode}
+ setCloudTranscriptionMode={setCloudTranscriptionMode}
+ useLocalWhisper={useLocalWhisper}
+ setUseLocalWhisper={setUseLocalWhisper}
+ updateTranscriptionSettings={updateTranscriptionSettings}
+ cloudTranscriptionProvider={cloudTranscriptionProvider}
+ setCloudTranscriptionProvider={setCloudTranscriptionProvider}
+ cloudTranscriptionModel={cloudTranscriptionModel}
+ setCloudTranscriptionModel={setCloudTranscriptionModel}
+ localTranscriptionProvider={localTranscriptionProvider}
+ setLocalTranscriptionProvider={setLocalTranscriptionProvider}
+ whisperModel={whisperModel}
+ setWhisperModel={setWhisperModel}
+ parakeetModel={parakeetModel}
+ setParakeetModel={setParakeetModel}
+ cloudTranscriptionBaseUrl={cloudTranscriptionBaseUrl}
+ setCloudTranscriptionBaseUrl={setCloudTranscriptionBaseUrl}
+ transcriptionMode={transcriptionMode}
+ setTranscriptionMode={setTranscriptionMode}
+ remoteTranscriptionUrl={remoteTranscriptionUrl}
+ setRemoteTranscriptionUrl={setRemoteTranscriptionUrl}
+ showTranscriptionPreview={showTranscriptionPreview}
+ setShowTranscriptionPreview={setShowTranscriptionPreview}
+ toast={toast}
+ />
+ {transcriptionMode === "local" &&
+ localTranscriptionProvider !== "nvidia" &&
+ renderWhisperVadSettings()}
+ </div>
+ )}
+ renderNoteRecording={() => (
+ <div className="space-y-6">
+ <MeetingTranscriptionPanel />
+ {transcriptionMode === "local" &&
+ localTranscriptionProvider !== "nvidia" &&
+ renderWhisperVadSettings()}
+ </div>
+ )}
+ />
+ </TabPanel>
+ )}
+ {hasMountedLlms && (
+ <TabPanel active={activeSection === "llms"}>
+ <LlmsTabs
+ initialTab={
+ activeSection === "llms" ? (initialSubTab as LlmTab | undefined) : undefined
+ }
+ renderChatIntelligence={() => <ChatAgentSettings />}
+ renderDictationCleanup={() => (
+ <div className="space-y-6">
+ <AiModelsSection
+ useCleanupModel={useCleanupModel}
+ setUseCleanupModel={(value) => {
+ updateCleanupSettings({ useCleanupModel: value });
+ }}
+ toast={toast}
+ />
+ <div className="border-t border-border/40 pt-6">
+ <SectionHeader
+ title={t("settingsPage.prompts.title")}
+ description={t("settingsPage.prompts.description")}
+ />
+ <PromptStudio />
+ </div>
+ </div>
+ )}
+ renderDictationAgent={() => <DictationAgentSettings />}
+ renderNoteFormatting={() => <NoteFormattingSettings />}
+ />
+ </TabPanel>
+ )}
{renderSectionContent()}
</>
);