Skip to content

Commit 867d21b

Browse files
committed
fix(desktop): install queued update after errors
1 parent 95b8bc6 commit 867d21b

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎apps/desktop/src/updates/DesktopUpdates.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,9 @@ describe("DesktopUpdates", () => {
460460
assert.equal(state.status, "error");
461461
assert.equal(state.downloadedVersion, "1.2.4");
462462
assert.isNull(state.errorContext);
463+
464+
const result = yield* updates.install;
465+
assert.isTrue(result.accepted);
463466
}),
464467
).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer)));
465468
});

‎apps/desktop/src/updates/DesktopUpdates.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,15 @@ export const make = Effect.gen(function* () {
451451

452452
const installDownloadedUpdate = Effect.gen(function* () {
453453
const state = yield* Ref.get(updateStateRef);
454+
const hasInstallableDownload =
455+
state.downloadedVersion !== null &&
456+
(state.status === "downloaded" ||
457+
(state.status === "error" &&
458+
(state.errorContext === null || state.errorContext === "install")));
454459
if (
455460
(yield* Ref.get(desktopState.quitting)) ||
456461
!(yield* Ref.get(updaterConfiguredRef)) ||
457-
state.status !== "downloaded"
462+
!hasInstallableDownload
458463
) {
459464
return { accepted: false, completed: false };
460465
}

0 commit comments

Comments
 (0)