Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix: should install new version after quit this instance (#10064)

Shinji-Li9ab77b2ea763
diff --git a/apps/desktop/src/main/core/infrastructure/UpdaterManager.ts b/apps/desktop/src/main/core/infrastructure/UpdaterManager.ts
index cdd2e111f8f..91832244cb7 100644
--- a/apps/desktop/src/main/core/infrastructure/UpdaterManager.ts
+++ b/apps/desktop/src/main/core/infrastructure/UpdaterManager.ts
@@ -141,8 +141,29 @@ export class UpdaterManager {
// Mark application for exit
this.app.isQuiting = true;
- // Delay installation by 1 second to ensure window is closed
- autoUpdater.quitAndInstall();
+ // Close all windows first to ensure clean exit
+ logger.info('Closing all windows before update installation...');
+ const { BrowserWindow, app } = require('electron');
+ const allWindows = BrowserWindow.getAllWindows();
+ allWindows.forEach((window) => {
+ if (!window.isDestroyed()) {
+ window.close();
+ }
+ });
+
+ // Release single instance lock before quitting
+ // This ensures the new instance can acquire the lock
+ logger.info('Releasing single instance lock...');
+ app.releaseSingleInstanceLock();
+
+ // Small delay to ensure windows are closed and lock is released
+ setTimeout(() => {
+ // quitAndInstall parameters:
+ // - isSilent: true (don't show installation UI)
+ // - isForceRunAfter: true (force start app after installation)
+ logger.info('Calling autoUpdater.quitAndInstall...');
+ autoUpdater.quitAndInstall(true, true);
+ }, 100);
};
/**