From 49503afc89138cced74268593005b95c3275ec67 Mon Sep 17 00:00:00 2001 From: dataCenter430 Date: Sun, 15 Feb 2026 16:21:49 -0700 Subject: [PATCH] fix(electron): skip single-instance lock in dev to prevent dev server exit --- electron/main/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/electron/main/index.ts b/electron/main/index.ts index b2001bbf0..171c9b829 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -209,7 +209,9 @@ if (os.release().startsWith('6.1')) app.disableHardwareAcceleration(); // Set application name for Windows 10+ notifications if (process.platform === 'win32') app.setAppUserModelId(app.getName()); -if (!app.requestSingleInstanceLock()) { +// Only enforce single-instance in production. In dev, a second instance (e.g. second +// npm run dev) would quit here and take its dev server down; skip so multiple dev instances work. +if (!VITE_DEV_SERVER_URL && !app.requestSingleInstanceLock()) { app.quit(); process.exit(0); } @@ -303,6 +305,10 @@ function processQueuedProtocolUrls() { // ==================== single instance lock ==================== const setupSingleInstanceLock = () => { + if (VITE_DEV_SERVER_URL) { + // Dev: allow multiple instances so a second npm run dev doesn't quit and kill its dev server + return; + } const gotLock = app.requestSingleInstanceLock(); if (!gotLock) { log.info('no-lock');