Skip to content

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

fix(updater): forward update events to live window refs (#1175)

Alcahest Malus Dienheim7fe67042bab4
diff --git a/main.js b/main.js
index 58c33f73a..7d7137b6a 100644
--- a/main.js
+++ b/main.js
@@ -1043,7 +1043,6 @@ async function startApp() {
trayManager.setCreateControlPanelCallback(() => windowManager.createControlPanelWindow());
await trayManager.createTray();
- updateManager.setWindows(windowManager.mainWindow, windowManager.controlPanelWindow);
updateManager.checkForUpdatesOnStartup();
if (process.platform === "darwin") {
diff --git a/src/updater.js b/src/updater.js
index e66812bb6..4208455f5 100644
--- a/src/updater.js
+++ b/src/updater.js
@@ -2,8 +2,6 @@ const { autoUpdater } = require("electron-updater");
class UpdateManager {
constructor() {
- this.mainWindow = null;
- this.controlPanelWindow = null;
this.updateAvailable = false;
this.updateDownloaded = false;
this.lastUpdateInfo = null;
@@ -19,11 +17,6 @@ class UpdateManager {
this.setupAutoUpdater();
}
- setWindows(mainWindow, controlPanelWindow) {
- this.mainWindow = mainWindow;
- this.controlPanelWindow = controlPanelWindow;
- }
-
setWindowManager(windowManager) {
this.windowManager = windowManager;
}
@@ -158,15 +151,13 @@ class UpdateManager {
}
notifyRenderers(channel, data) {
- if (this.mainWindow && !this.mainWindow.isDestroyed() && this.mainWindow.webContents) {
- this.mainWindow.webContents.send(channel, data);
- }
- if (
- this.controlPanelWindow &&
- !this.controlPanelWindow.isDestroyed() &&
- this.controlPanelWindow.webContents
- ) {
- this.controlPanelWindow.webContents.send(channel, data);
+ // Read window refs live from windowManager: cached refs go stale when the
+ // control panel is created after boot (start minimized) or recreated.
+ const { mainWindow, controlPanelWindow } = this.windowManager ?? {};
+ for (const win of [mainWindow, controlPanelWindow]) {
+ if (win && !win.isDestroyed() && win.webContents) {
+ win.webContents.send(channel, data);
+ }
}
}