Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions apps/desktop/src/main/lib/auto-updater.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { EventEmitter } from "node:events";
import { app, dialog } from "electron";
import { BrowserWindow, app, dialog } from "electron";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Unused BrowserWindow import

BrowserWindow was added to the import on this line but is never referenced anywhere in the file. This will likely trigger a lint/compiler warning and should be removed.

Suggested change
import { BrowserWindow, app, dialog } from "electron";
import { app, dialog } from "electron";

import { autoUpdater } from "electron-updater";
import { env } from "main/env.main";
import { exitImmediately } from "main/index";
import { quitApp } from "main/index";
import { prerelease } from "semver";
import { AUTO_UPDATE_STATUS, type AutoUpdateStatus } from "shared/auto-update";
import { PLATFORM } from "shared/constants";
Expand Down Expand Up @@ -91,10 +91,8 @@ export function installUpdate(): void {
emitStatus(AUTO_UPDATE_STATUS.IDLE);
return;
}
setSkipQuitConfirmation();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 setSkipQuitConfirmation is undefined — will throw ReferenceError at runtime

setSkipQuitConfirmation is called here but is never defined in this file and is not imported from anywhere. The only reference to it in the entire codebase is this call site (apps/desktop/src/main/lib/auto-updater.ts:94), meaning installUpdate() will throw a ReferenceError every time a user tries to install an update.

In apps/desktop/src/main/index.ts (line 154) there is a module-level skipQuitConfirmation variable that quitApp() sets to true before calling app.quit(). The intent here appears to be skipping the quit-confirmation dialog so autoUpdater.quitAndInstall() can proceed unblocked. The missing piece is a dedicated exported setter in main/index.ts:

// In apps/desktop/src/main/index.ts — add and export this function
export function setSkipQuitConfirmation(): void {
    skipQuitConfirmation = true;
}

Then import it in auto-updater.ts:

import { quitApp, setSkipQuitConfirmation } from "main/index";

Without this fix the update install path is completely broken.

autoUpdater.quitAndInstall(false, true);
// MacUpdater.quitAndInstall() may not quit if Squirrel hasn't
// finished its internal download from the localhost proxy.
exitImmediately();
}

export function dismissUpdate(): void {
Expand Down
Loading