Introducing a new way to review your PRs.

Read the announcement

jgraph / drawio-desktop

Official electron build of draw.io

View on GitHub

10 documents · Updated Nov 16, 2026

docs / update-preferences

Update Preferences

Overview

Update preference handling is split into small policy helpers under src/main/ and consumed by the Electron shell in src/…/electron.js. src/…/update-mode.js decides whether the running install should use automatic in-place updates, notify-only update discovery, or no updater at all. Its getUpdateMode(...) return values are:

  • auto: the app may download updates and install them on quit or through Restart to Update.
  • notify: the app checks for releases, but only exposes the release page URL instead of installing in place.
  • off: the app does not configure or check electron-updater.

src/…/electron.js turns explicit disable signals into off before calling getUpdateMode(...): src/…/disableUpdate.js currently exports disableUpdate() as false, while DRAWIO_DISABLE_UPDATE=true and --disable-update also disable updates. When the effective mode is off, src/…/electron.js passes disableUpdate=1 into URL state, omits update menu items, and skips autoUpdater.setFeedURL(...) and scheduled checks.

src/…/update-mode.js treats app-store or sandbox-managed installs as off: Windows Store (windowsStore), Snap (env.SNAP), and Flatpak (/.flatpak-info). macOS returns auto. Windows returns notify for portable builds (PORTABLE_EXECUTABLE_FILE) and for installs without the NSIS uninstaller next to execPath; only an NSIS install with Uninstall <productName>.exe beside the executable returns auto. Linux AppImage returns auto; deb/rpm-style installs with resourcesPath/package-type return notify; unknown Linux packaging returns off. getReleaseUrl(version) builds the GitHub release tag URL used by notify mode, and src/…/electron.js opens that URL from the update notice.

src/…/update-channel.js handles the only custom feed channel: Windows arm64 returns latest-arm64, while all other platform/architecture pairs return null and use electron-updater defaults. src/…/electron.js applies this channel when configuring the GitHub feed for jgraph/drawio-desktop.

The tests pin these policies. src/…/update-mode.test.js exercises each packaging branch plus getReleaseUrl(...). src/…/update-channel.test.js checks Windows arm64, Windows x64, macOS, and Linux channel choices, and reads electron-builder-win-arm64.json and electron-builder-win.json so the app-requested arm64 channel stays aligned with the publish configuration.

Coupling

  • If src/…/update-channel.js changes the Windows arm64 channel name, also update electron-builder-win-arm64.json and src/…/update-channel.test.js; the arm64 app asks electron-updater for this channel, and electron-builder must publish the same manifest name.
  • If Windows installer targets or artifact layout change, verify src/…/update-mode.js and src/…/update-mode.test.js: Windows auto mode depends on finding Uninstall <productName>.exe beside process.execPath, while portable builds are detected through PORTABLE_EXECUTABLE_FILE.
  • If Linux packaging changes, verify the marker and environment checks in src/…/update-mode.js: AppImage is keyed from APPIMAGE, deb/rpm notify mode from resourcesPath/package-type, Snap from SNAP, and Flatpak from /.flatpak-info.
  • If disable-update behavior changes in src/…/disableUpdate.js, keep src/…/electron.js expectations in mind: its result is ORed with DRAWIO_DISABLE_UPDATE=true and --disable-update, then converted into updateMode == 'off' before menus, URL state, feed setup, and update checks are initialized.

Risks

  • src/…/update-channel.js and electron-builder-win-arm64.json must stay synchronized. The comments and src/…/update-channel.test.js reference jgraph/drawio-desktop#2197: Windows update manifests do not include an architecture suffix by default, so if arm64 stops using latest-arm64, x64 and arm64 publishing can overwrite the same latest.yml and clients can see the wrong update feed.
  • src/…/update-mode.js intentionally keeps non-NSIS Windows installs out of automatic in-place updates. The comments cite jgraph/drawio-desktop#2142: if MSI, zip, or portable builds are misclassified as auto, running the NSIS updater over them can leave files that no installer tracks.
  • src/…/update-mode.js leaves package-manager-managed Linux and store/sandbox installs out of in-app installation. The comments cite jgraph/drawio-desktop#2569: if deb/rpm, Snap, Flatpak, or Store installs are moved to auto, the desktop updater can compete with the package manager or platform store instead of letting those systems update the app.