Skip to content

fix: restart to install update, and three update-flow bugs - #3167

Merged
afonsojramos merged 4 commits into
mainfrom
antananarivo
Aug 8, 2026
Merged

fix: restart to install update, and three update-flow bugs#3167
afonsojramos merged 4 commits into
mainfrom
antananarivo

Conversation

@afonsojramos

Copy link
Copy Markdown
Member

Summary

The "Restart to install update" button and the post-download Restart dialog button both did nothing. Root cause turned out to be in electron-menubar, fixed there and released as v10.2.0. Three smaller update-flow bugs found along the way are fixed here.

Why restart-to-update was a silent no-op

Applying an update never goes through app.quit(). Electron's autoUpdater.quitAndInstall() does this:

Emit("before-quit-for-update");
if (WindowList::IsEmpty()) { QuitAndInstall(); return; }
WindowList::AddObserver(this);
WindowList::CloseAllWindows();   // quits only once the list empties

before-quit is emitted after the windows close, not before. electron-menubar's hideOnClose only let a close through once before-quit had fired, so it vetoed the close, the window list never emptied, OnWindowAllClosed never fired, and the install stalled with no error and no log.

macOS only in practice: on Windows and Linux, electron-updater's BaseUpdater.quitAndInstall calls app.quit() itself, which emits before-quit first. Long-standing, not a regression from the v10 migration, the pre-#2880 hand-rolled close handler had the same isQuitting gate.

Fixed in electron-menubar (gitify-app/electron-menubar#139) by binding its before-quit handler to autoUpdater's before-quit-for-update as well. No Gitify code change needed, just the bump.

Also fixed here

Bug Fix
One transient network error permanently stopped periodic update checks for the session: the error handler called resetState(), which cleared the interval. resetState() is now UI-only and leaves the schedule running. Dropped the write-only periodicInterval field.
The dialog read "Gitify undefined has been downloaded" when the release had no name (UpdateInfo.releaseName is string | null). Falls back to event.version.
On Linux, toggling a tray item's visibility did nothing until the next window show/hide, because libappindicator serves a cached serialization of the menu. The update-item setters call menubar.refreshContextMenu(), a new v10.2.0 API. No-op on macOS and Windows.

Testing

Every fix has a test that was verified to fail against the unfixed code and pass after, by reverting only the source and re-running:

Bug Failure without the fix
Restart-to-update expected undefined to be type of 'function' (electron-menubar suite)
Periodic checks die on error zero further checks after one error event
undefined in dialog "Gitify undefined has been downloaded"
Linux menu never refreshes refreshContextMenu never called

1317 tests across 166 files pass, tsc --noEmit clean, vp check clean. Visual regression tests are Linux-only by design and were not run locally; CI covers them.

@afonsojramos
afonsojramos requested a review from setchy as a code owner August 8, 2026 15:59
@github-actions github-actions Bot added bug Something isn't working dependency Dependency updates labels Aug 8, 2026
@sonarqubecloud

sonarqubecloud Bot commented Aug 8, 2026

Copy link
Copy Markdown

@afonsojramos
afonsojramos merged commit 01fed23 into main Aug 8, 2026
17 checks passed
@afonsojramos
afonsojramos deleted the antananarivo branch August 8, 2026 17:36
@github-actions github-actions Bot added this to the Release 7.x.x milestone Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dependency Dependency updates

Development

Successfully merging this pull request may close these issues.

2 participants