Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Commit f1563f9

Browse files
authored
fix(settings): Show available update in Updates panel (#3678)
1 parent ed26e21 commit f1563f9

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

packages/core/src/settings/updateStatus.test.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,41 @@ describe("deriveUpdateStatus", () => {
4545
});
4646
});
4747

48+
it("reports an available update with a version", () => {
49+
expect(
50+
deriveUpdateStatus({
51+
checking: false,
52+
available: true,
53+
availableVersion: "1.2.3",
54+
}),
55+
).toEqual({
56+
message: "Update 1.2.3 available",
57+
type: "success",
58+
checking: false,
59+
});
60+
});
61+
62+
it("reports an available update without a version", () => {
63+
expect(deriveUpdateStatus({ checking: false, available: true })).toEqual({
64+
message: "Update available",
65+
type: "success",
66+
checking: false,
67+
});
68+
});
69+
70+
it("reports a check error", () => {
71+
expect(
72+
deriveUpdateStatus({
73+
checking: false,
74+
error: "Update check timed out. Please try again.",
75+
}),
76+
).toEqual({
77+
message: "Update check timed out. Please try again.",
78+
type: "error",
79+
checking: false,
80+
});
81+
});
82+
4883
it("clears checking when finished with no other signal", () => {
4984
expect(deriveUpdateStatus({ checking: false })).toEqual({
5085
checking: false,

packages/core/src/settings/updateStatus.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
export interface RawUpdateStatus {
22
checking?: boolean;
33
downloading?: boolean;
4+
available?: boolean;
45
upToDate?: boolean;
56
updateReady?: boolean;
67
version?: string;
8+
availableVersion?: string;
9+
error?: string;
710
}
811

912
export interface DerivedUpdateStatus {
@@ -34,6 +37,18 @@ export function deriveUpdateStatus(
3437
checking: false,
3538
};
3639
}
40+
if (status.checking === false && status.available) {
41+
return {
42+
message: status.availableVersion
43+
? `Update ${status.availableVersion} available`
44+
: "Update available",
45+
type: "success",
46+
checking: false,
47+
};
48+
}
49+
if (status.checking === false && status.error) {
50+
return { message: status.error, type: "error", checking: false };
51+
}
3752
if (status.checking === false) {
3853
return { checking: false };
3954
}

0 commit comments

Comments
 (0)