How the draw.io Desktop Auto-Update Mechanism Works (and How to Disable It)
draw.io Desktop uses electron-updater to automatically check GitHub for new releases, but you can disable updates via environment variables, CLI flags, Flatpak sandboxing, or by modifying src/main/disableUpdate.js.
The auto-update mechanism in draw.io Desktop is implemented in the Electron main process and handles automatic detection, downloading, and installation of new versions from the official GitHub repository. This guide explains the internal workflow defined in src/main/electron.js and documents every method available to disable or configure automatic updates.
How the Auto-Update Mechanism Works
Initialization and Configuration
The application initializes the updater by importing electron-updater in src/main/electron.js and creating an autoUpdater instance. Error logging is routed through electron-log to keep update-related diagnostics separate from the main application logs.
import elecUpPkg from 'electron-updater';
const {autoUpdater} = elecUpPkg;
autoUpdater.logger = log;
autoUpdater.logger.transports.file.level = 'error';
autoUpdater.logger.transports.console.level = 'error';
The feed URL points directly to the GitHub releases page, ensuring the app checks for new versions immediately upon launch.
autoUpdater.setFeedURL({
provider: 'github',
repo: 'drawio-desktop',
owner: 'jgraph'
});
Update Check Logic and Disable Flags
Before checking for updates, the application evaluates a disableUpdate boolean that combines multiple override mechanisms. This logic appears early in src/main/electron.js and aggregates signals from environment variables, command-line arguments, and sandbox detection.
import {disableUpdate as disUpPkg} from './disableUpdate.js';
const disableUpdate = disUpPkg() ||
process.env.DRAWIO_DISABLE_UPDATE === 'true' ||
process.argv.indexOf('--disable-update') !== -1 ||
fs.existsSync('/.flatpak-info');
The default export from src/main/disableUpdate.js returns false, enabling updates by default. However, any of the following conditions forces disableUpdate to true:
- Setting the environment variable
DRAWIO_DISABLE_UPDATE=true - Launching with the CLI flag
--disable-update - Running inside a Flatpak sandbox (detected via
/.flatpak-info) - Modifying
disableUpdate.jsto returntrueat build time
Silent Updates vs. Interactive Updates
Even when updates are enabled, you can configure silent updates that download and install automatically without user interaction. This is controlled by the DRAWIO_SILENT_UPDATE environment variable or the --silent-update CLI flag.
const silentUpdate = !disableUpdate && (
process.env.DRAWIO_SILENT_UPDATE === 'true' ||
process.argv.indexOf('--silent-update') !== -1);
autoUpdater.autoDownload = silentUpdate;
autoUpdater.autoInstallOnAppQuit = silentUpdate;
When silent mode is active, the update downloads in the background and installs when the application quits. When disabled, the app presents interactive dialogs to the user.
Automatic Checks on Startup
The application决定是否检查更新 (decides whether to check for updates) based on both the disableUpdate flag and a persistent user preference stored in Electron Store.
if (store == null || (!disableUpdate && !store.get('dontCheckUpdates'))) {
autoUpdater.checkForUpdates();
}
If the user has previously clicked "Don't Ask Again" in the update dialog, the key dontCheckUpdates is set to true in the store, and the application skips the automatic check on subsequent launches.
User-Facing Update Workflow
When updates are enabled and available, src/main/electron.js registers event listeners that handle the complete user experience:
update-available– Displays a dialog with three options: Download, Cancel, or Don't Ask Again. Selecting "Don't Ask Again" persists the opt-out viastore.set('dontCheckUpdates', true).download-progress– Renders a progress bar window showing download percentage.update-downloaded– Prompts the user to install immediately (callingautoUpdater.quitAndInstall()) or defer until the next application launch.error– Logs update failures through the configuredelectron-logtransport.
On macOS, the application menu is also modified based on the disableUpdate flag. If updates are disabled, the "Check for updates" menu item is removed:
if (disableUpdate) {
template[0].submenu.splice(2, 1);
}
How to Disable Auto-Updates in draw.io Desktop
Using Environment Variables
Set the DRAWIO_DISABLE_UPDATE environment variable before launching the application. This method works across all platforms and requires no code changes.
# Linux/macOS
export DRAWIO_DISABLE_UPDATE=true
drawio-desktop
# Windows (PowerShell)
$env:DRAWIO_DISABLE_UPDATE="true"
.\drawio-desktop.exe
Using Command-Line Flags
Pass the --disable-update flag when launching the binary. This overrides the default behavior without modifying system environment variables.
drawio-desktop --disable-update
Flatpak Sandbox Detection
If you install draw.io Desktop via Flatpak, the auto-update mechanism is automatically disabled. The application detects the presence of /.flatpak-info in the filesystem and sets disableUpdate to true, preventing the updater from attempting to modify the read-only sandbox.
In-Application Opt-Out
When an update notification appears, click "Don't Ask Again". This stores a persistent flag in the Electron Store database:
- Linux:
~/.config/draw.io/Store.json - Windows:
%APPDATA%\draw.io\Store.json - macOS:
~/Library/Application\ Support/draw.io/Store.json
The stored JSON includes:
{
"dontCheckUpdates": true
}
Delete this key or set it to false to re-enable automatic checks.
Build-Time Configuration
For enterprise deployments or custom builds, permanently disable updates by modifying src/main/disableUpdate.js:
export function disableUpdate() {
return true;
}
After making this change, rebuild the application using npm run build. This hardcoded flag takes precedence and ensures the application never contacts GitHub for updates, regardless of environment variables or CLI arguments.
Summary
- draw.io Desktop uses
electron-updaterinsrc/main/electron.jsto poll GitHub releases for new versions. - The
disableUpdateflag controls the entire mechanism and can be triggered viaDRAWIO_DISABLE_UPDATE=true, the--disable-updateCLI flag, Flatpak sandbox detection, or code modification. - Silent updates are available via
DRAWIO_SILENT_UPDATEor--silent-update, enabling background download and automatic installation on quit. - Users can opt-out persistently by clicking "Don't Ask Again" in the update dialog, which stores
dontCheckUpdates: truein Electron Store. - The menu bar on macOS dynamically removes the "Check for updates" entry when updates are disabled.
Frequently Asked Questions
Where does draw.io Desktop store the "Don't Ask Again" preference?
The preference is stored in the Electron Store configuration file. On Linux, this is located at ~/.config/draw.io/Store.json; on Windows at %APPDATA%\draw.io\Store.json; and on macOS at ~/Library/Application Support/draw.io/Store.json. The key dontCheckUpdates is set to true when you opt out.
Can I re-enable auto-updates after disabling them via the GUI?
Yes. Close draw.io Desktop, open the Store file appropriate for your operating system, and either delete the dontCheckUpdates key or set its value to false. Alternatively, removing the entire Store file resets all preferences to defaults, re-enabling update checks.
Does draw.io Desktop install updates automatically without asking?
Only if silent update mode is enabled via the DRAWIO_SILENT_UPDATE=true environment variable or the --silent-update CLI flag. By default, the application shows a dialog when an update is available and waits for user confirmation before downloading and installing.
Why are updates disabled automatically in Flatpak installations?
Flatpak applications run in a sandboxed environment where the application cannot modify its own binaries. The presence of /.flatpak-info signals to draw.io Desktop that it is running in this environment, automatically setting disableUpdate to true to prevent permission errors and update conflicts managed by the Flatpak runtime itself.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →