Skip to content

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

fix: suppress meeting detection notifications when meeting mode is active

Gabriel Steinc94dfe4252df
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index 7d8bd91fa..a90991f04 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -302,6 +302,7 @@ class IPCHandlers {
ipcMain.handle("restore-from-meeting-mode", () => {
this.windowManager.restoreControlPanelFromMeetingMode();
+ this.meetingDetectionEngine?.setMeetingModeActive(false);
});
ipcMain.handle("app-quit", () => {
diff --git a/src/helpers/meetingDetectionEngine.js b/src/helpers/meetingDetectionEngine.js
index f2d75c5dc..a7c21eb1f 100644
--- a/src/helpers/meetingDetectionEngine.js
+++ b/src/helpers/meetingDetectionEngine.js
@@ -19,6 +19,7 @@ class MeetingDetectionEngine {
this.activeDetections = new Map();
this.preferences = { processDetection: true, audioDetection: true };
this._userRecording = false;
+ this._meetingModeActive = false;
this._notificationQueue = [];
this._postRecordingCooldown = null;
this._bindListeners();
@@ -57,6 +58,15 @@ class MeetingDetectionEngine {
return;
}
+ if (this._meetingModeActive) {
+ debugLogger.info(
+ "Suppressing detection — meeting mode already active",
+ { detectionId },
+ "meeting"
+ );
+ return;
+ }
+
const calendarState = this.googleCalendarManager?.getActiveMeetingState?.();
if (calendarState) {
if (calendarState.activeMeeting) {
@@ -165,6 +175,7 @@ class MeetingDetectionEngine {
const detection = this.activeDetections.get(detectionId);
if (action === "start" && detection) {
+ this._meetingModeActive = true;
const eventSummary = detection.event?.summary || "New note";
const noteResult = this.databaseManager.saveNote(eventSummary, "", "meeting");
@@ -195,6 +206,7 @@ class MeetingDetectionEngine {
}
async startManualMeeting() {
+ this._meetingModeActive = true;
debugLogger.info("Starting manual meeting", {}, "meeting");
const event = {
@@ -247,6 +259,12 @@ class MeetingDetectionEngine {
_flushNotificationQueue() {
if (this._notificationQueue.length === 0) return;
+ if (this._meetingModeActive) {
+ debugLogger.info("Dropping queued notifications — meeting mode active", {}, "meeting");
+ this._notificationQueue = [];
+ return;
+ }
+
debugLogger.info(
"Flushing notification queue",
{ count: this._notificationQueue.length },
@@ -278,6 +296,11 @@ class MeetingDetectionEngine {
this.audioActivityDetector.dismiss();
}
+ setMeetingModeActive(active) {
+ this._meetingModeActive = active;
+ debugLogger.info("Meeting mode active state changed", { active }, "meeting");
+ }
+
setUserRecording(active) {
this._userRecording = active;
this.audioActivityDetector.setUserRecording(active);
@@ -327,6 +350,7 @@ class MeetingDetectionEngine {
this.meetingProcessDetector.stop();
this.audioActivityDetector.stop();
this.activeDetections.clear();
+ this._meetingModeActive = false;
if (this._postRecordingCooldown) {
clearTimeout(this._postRecordingCooldown);
this._postRecordingCooldown = null;
diff --git a/src/hooks/useMeetingTranscription.ts b/src/hooks/useMeetingTranscription.ts
index bc01a3f2e..f73a5aab1 100644
--- a/src/hooks/useMeetingTranscription.ts
+++ b/src/hooks/useMeetingTranscription.ts
@@ -233,6 +233,7 @@ export function useMeetingTranscription(): UseMeetingTranscriptionReturn {
const isPreparedRef = useRef(false);
const preparePromiseRef = useRef<Promise<void> | null>(null);
const ipcCleanupsRef = useRef<Array<() => void>>([]);
+ const mountGenRef = useRef(0);
const cleanup = useCallback(async () => {
const processors = [processorRef, micProcessorRef];
@@ -264,6 +265,8 @@ export function useMeetingTranscription(): UseMeetingTranscriptionReturn {
ipcCleanupsRef.current.forEach((fn) => fn());
ipcCleanupsRef.current = [];
isPreparedRef.current = false;
+ isRecordingRef.current = false;
+ isStartingRef.current = false;
}, []);
const stopTranscription = useCallback(async () => {
@@ -335,8 +338,9 @@ export function useMeetingTranscription(): UseMeetingTranscriptionReturn {
const startTranscription = useCallback(async () => {
if (isRecordingRef.current || isStartingRef.current) return;
isStartingRef.current = true;
+ const gen = mountGenRef.current;
- logger.info("Meeting transcription starting...", {}, "meeting");
+ logger.info("Meeting transcription starting...", { gen }, "meeting");
setTranscript("");
setPartialTranscript("");
setSegments([]);
@@ -354,6 +358,15 @@ export function useMeetingTranscription(): UseMeetingTranscriptionReturn {
await preparePromiseRef.current;
}
+ // Abort if component was remounted (StrictMode) during prepare wait
+ if (mountGenRef.current !== gen) {
+ logger.info("startTranscription aborted — stale mount (after prepare)", { gen }, "meeting");
+ isRecordingRef.current = false;
+ isStartingRef.current = false;
+ setIsRecording(false);
+ return;
+ }
+
try {
const startTime = performance.now();
@@ -374,9 +387,13 @@ export function useMeetingTranscription(): UseMeetingTranscriptionReturn {
const streamsMs = performance.now() - startTime;
- // Abort if stop was called during setup
- if (!isRecordingRef.current) {
- logger.info("Meeting transcription aborted during setup (stop called)", {}, "meeting");
+ // Abort if stop was called during setup or component remounted (StrictMode)
+ if (!isRecordingRef.current || mountGenRef.current !== gen) {
+ logger.info(
+ "Meeting transcription aborted during setup",
+ { gen, stale: mountGenRef.current !== gen },
+ "meeting"
+ );
stream?.getTracks().forEach((t) => t.stop());
micResult?.getTracks().forEach((t) => t.stop());
isStartingRef.current = false;
@@ -520,11 +537,11 @@ export function useMeetingTranscription(): UseMeetingTranscriptionReturn {
processorRef.current = systemPipeline.processor;
}
- // Abort if stop was called during pipeline setup
- if (!isRecordingRef.current) {
+ // Abort if stop was called during pipeline setup or component remounted
+ if (!isRecordingRef.current || mountGenRef.current !== gen) {
logger.info(
- "Meeting transcription aborted during pipeline setup (stop called)",
- {},
+ "Meeting transcription aborted during pipeline setup",
+ { gen, stale: mountGenRef.current !== gen },
"meeting"
);
isStartingRef.current = false;
@@ -571,11 +588,9 @@ export function useMeetingTranscription(): UseMeetingTranscriptionReturn {
}, []);
useEffect(() => {
+ mountGenRef.current++;
return () => {
- // Don't reset isRecordingRef here — StrictMode double-mount would abort in-flight setup
- if (isRecordingRef.current) {
- void cleanup();
- }
+ void cleanup();
};
}, [cleanup]);