Make the built-in updater more robust and remove reliance on a specific update path - #257
Merged
ZFordDev merged 5 commits intoSep 1, 2026
Conversation
Add a pending-update.json marker in userData so a downloaded update survives closing and reopening SnapDock. The update is written when electron-updater finishes downloading and cleared on install. The renderer can query the persisted state at startup via update:pending so a previously-downloaded update is recognized without re-downloading.
Drive the Tools->Update button and footer indicator from a single updater state (idle/available/checking/downloading/ready/installing/upToDate/ error/disabled) so they never drift out of sync. The state machine also: - Recognizes a persisted pending update at startup and surfaces the ready state immediately without re-downloading. - Adds an explicit 'available' state distinct from 'ready' (downloaded), so a newly-detected update is not incorrectly labeled as installable. - Wires the footer indicator to download (available) or install (ready) on click, giving a second apply path beyond the Tools menu. - Adds CSS modifiers for every state (header.css + footer.css) and removes dead #update styles in modal.css that targeted a nonexistent ID.
Closing SnapDock while an update is downloaded and pending now applies it, making the long-standing 'close to update' prompt truthful. finishWindowClose checks for a persisted pending update first and routes through quitAndInstall() so the update is applied after unsaved changes are resolved. setupUpdater now returns a handle exposing hasPendingUpdate()/applyPendingUpdate() so the main process can drive update application independently of the UI path. Combined with the clickable footer and Tools menu action, a downloaded update can now be applied via several equivalent exit/restart routes.
…onfig (#254) Recovery: - pendingUpdate.resolvePendingUpdate() compares the running version against the persisted pending marker on startup. If the app now runs the pending version, the update applied → marker cleared. If it is still on the old version, the update remains ready to apply. If neither matches, the install was interrupted → the stale marker is cleared and the UI surfaces a recovery message. - installUpdate no longer clears the marker before quitAndInstall() so the marker survives the install and lets us detect success/failure on next launch (previously it was cleared optimistically). Config: - Add an explicit github publish block (owner/repo) to electron-builder so the update feed is not resolved implicitly from repository.url, removing reliance on a specific/assumed update path.
Document that a downloaded update stays pending until applied and can be applied from the Tools menu, the status-bar indicator, or by closing SnapDock.
ZFordDev
deleted the
254-make-the-built-in-updater-more-robust-and-remove-reliance-on-a-specific-update-path
branch
September 1, 2026 02:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes the built-in updater more robust and removes reliance on a single update path (issue #254).
Previously a downloaded update was tied to the Tools → Update → "Restart to Update" sequence, and simply closing SnapDock did not reliably apply it. This PR makes a downloaded update a persistent pending update that remains until successfully applied, and provides several equivalent ways to apply it.
Changes by phase
1. Persistent pending-update state
src/modules/updater/pendingUpdate.js: writes/reads/clears apending-update.jsonmarker in the application-data directory when a download finishes.update:pendingIPC, so a previously-downloaded update is recognized without re-downloading.2. Multiple apply paths
finishWindowClose→quitAndInstall), making the long-standing "close to update" prompt truthful.setupUpdater()now returns a handle (hasPendingUpdate()/applyPendingUpdate()) so the main process can drive applies independently of the UI.3. Centralized updater state machine
ui/dropdownMenus.jsnow drives both the Tools button and footer from a single state:idle/available/checking/downloading/ready/installing/upToDate/error/disabled.header.css,footer.css); removed dead#update.*styles inmodal.cssthat targeted a nonexistent#updateID.available(detected, not downloaded) vsready(downloaded) states.4. Robustness & recovery
pendingUpdate.resolvePendingUpdate()compares the running version against the marker on startup to distinguish applied / ready / stale (interrupted install). Stale/interrupted markers are cleared and a recovery message is shown.quitAndInstall(); they survive the install so success is verifiable on next launch.publishprovider topackage.jsonso the update feed is not resolved implicitly fromrepository.url.5. Documentation
Verification
node scripts/bundle.js).npm testpasses with the same 2 pre-existing link-navigation failures already present onmain(Windows path-separator issue, unrelated to this work).Files changed
src/modules/updater/pendingUpdate.js(new)src/modules/updater/download.jssrc/modules/updater/index.jssrc/modules/ui/dropdownMenus.jssrc/preload.jssrc/styles/components/header.csssrc/styles/components/footer.csssrc/styles/components/modal.cssmain.jspackage.jsonassets/resources/docs/user_guide.mdCloses #254