Skip to content

fix: solve #3507 — macOS Update button silently fails after repeated clicks#3508

Draft
github-actions[bot] wants to merge 1 commit intomainfrom
triage/issue-3507-24526906366
Draft

fix: solve #3507 — macOS Update button silently fails after repeated clicks#3508
github-actions[bot] wants to merge 1 commit intomainfrom
triage/issue-3507-24526906366

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 16, 2026

Root cause

installUpdate() in apps/desktop/src/main/lib/auto-updater.ts had no
guard, so every click on the Install button fired another
autoUpdater.quitAndInstall(false, true).

On macOS, MacUpdater.quitAndInstall() re-registers a native-updater
update-downloaded listener every time it is called before Squirrel.Mac
has finished downloading. Each extra click stacks another listener —
and when Squirrel finally fires the event, every queued listener ends
up calling nativeUpdater.quitAndInstall() in parallel. Racing the
native updater like that can leave the downloaded binary un-swapped,
which matches the user report on #3507: the app closes after clicking
Update but relaunches on the old version.

The fix

  • Add an isInstalling guard so repeated clicks short-circuit instead of
    re-entering autoUpdater.quitAndInstall().
  • Only proceed when currentStatus === READY; otherwise log and no-op
    (nothing to install).
  • Reset the guard on the autoUpdater error event so a failed attempt
    can be retried without restarting the app.

Tests

Reproduction test in apps/desktop/src/main/lib/auto-updater.test.ts:

  • ignores install requests when no update is ready — clicking Install
    before the download finishes no longer calls quitAndInstall.
  • does not invoke quitAndInstall multiple times when the install button is clicked repeatedly — three rapid clicks now result in exactly one
    quitAndInstall call (pre-fix: three calls, reproducing the race).

Verified that both tests fail on main without the fix and pass with
the fix applied.

Closes #3507


Summary by cubic

Fixes #3507: Prevents the macOS Update button from failing after repeated clicks by guarding installs and only running when an update is ready. This stops electron-updater listener fan-out that caused relaunching on the old version.

Bug Fixes

  • Add isInstalling guard to ignore duplicate clicks and avoid parallel quitAndInstall() calls.
  • Require currentStatus === READY; otherwise log and no-op.
  • Clear the guard on autoUpdater error to allow retry; add tests for duplicate clicks and not-ready installs.

Written for commit cd2f8b2. Summary will update on new commits.

… calls

installUpdate had no guard, so every click on "Install" fired another
autoUpdater.quitAndInstall(). On macOS, MacUpdater.quitAndInstall()
re-registers a nativeUpdater "update-downloaded" listener when Squirrel
hasn't finished downloading yet; each extra click stacks another
listener, and when Squirrel finally fires the event every listener ends
up calling nativeUpdater.quitAndInstall() in parallel, which can leave
the downloaded binary un-swapped.

Add an isInstalling guard plus a "must be READY" precondition, and
reset the guard on autoUpdater errors so a failed attempt can be
retried without needing to relaunch the app.

Closes #3507
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Update didn't work for Mac client

0 participants