🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(desktop): restore downloaded state after deferred update checks (#20139)
AmAzing-d2b13949f4e2
diff --git a/apps/desktop/src/main/core/infrastructure/UpdaterManager.ts b/apps/desktop/src/main/core/infrastructure/UpdaterManager.tsindex 30b1ad08868..8b6800c8b1f 100644--- a/apps/desktop/src/main/core/infrastructure/UpdaterManager.ts+++ b/apps/desktop/src/main/core/infrastructure/UpdaterManager.ts@@ -485,6 +485,8 @@ export class UpdaterManager {logger.info(`Skipping auto-download — install-later acknowledged for v${this.installLaterVersion}, incoming v${info.version}`,);+ // Finish the check with the cached update still installable, without reopening its prompt.+ this.setStage('downloaded');return;}diff --git a/apps/desktop/src/main/core/infrastructure/__tests__/UpdaterManager.test.ts b/apps/desktop/src/main/core/infrastructure/__tests__/UpdaterManager.test.tsindex 9d5d120e1ff..876c00a94c8 100644--- a/apps/desktop/src/main/core/infrastructure/__tests__/UpdaterManager.test.ts+++ b/apps/desktop/src/main/core/infrastructure/__tests__/UpdaterManager.test.ts@@ -485,16 +485,36 @@ describe('UpdaterManager', () => {);});- it('skips auto-download on update-available for the install-later version', () => {- fireDownloaded('2.2.6');- updaterManager.installLater();-- vi.mocked(autoUpdater.downloadUpdate).mockClear();-- fireAvailable('2.2.6');-- expect(autoUpdater.downloadUpdate).not.toHaveBeenCalled();- });+ it.each([+ { incomingVersion: '2.2.6', manual: false },+ { incomingVersion: '2.2.6', manual: true },+ { incomingVersion: '2.2.5', manual: false },+ { incomingVersion: '2.2.5', manual: true },+ ])(+ 'restores the downloaded state after checking $incomingVersion (manual=$manual)',+ async ({ incomingVersion, manual }) => {+ fireDownloaded('2.2.6');+ updaterManager.installLater();+ mockBroadcast.mockClear();+ vi.mocked(autoUpdater.downloadUpdate).mockClear();+ vi.mocked(autoUpdater.checkForUpdates).mockImplementation(async () => {+ fireAvailable(incomingVersion);+ return null;+ });++ await updaterManager.checkForUpdates({ manual });++ const expectedState = {+ stage: 'downloaded',+ updateInfo: { kind: 'app', version: '2.2.6' },+ };+ expect(updaterManager.getUpdaterState()).toEqual(expectedState);+ expect(mockBroadcast).toHaveBeenLastCalledWith('updaterStateChanged', expectedState);+ expect(autoUpdater.downloadUpdate).not.toHaveBeenCalled();+ expect(mockBroadcast).not.toHaveBeenCalledWith('updateReady', expect.anything());+ expect(autoUpdater.autoInstallOnAppQuit).toBe(true);+ },+ );it('clears the guard and re-broadcasts when a newer version arrives', () => {fireDownloaded('2.2.6');