The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 23, 01:45 UTC
fix(desktop): explain why the update button is disabled (#18404)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: SAPHID <saphid@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Alex Southwell committed
Oct 20, 2026 at 06:29 UTC
65ba252b7008266510835b7b85c4b15d3babb460
6 files changed
+98
-15
apps/desktop/src/updates/DesktopUpdates.test.ts
+23
@@ -107,6 +107,29 @@ describe("DesktopUpdates", () => {
107
}),
108
);
109
110
+ it.effect("keeps the disabled reason available after configuration and channel changes", () => {
111
+ const harness = makeHarness({ env: { T3CODE_DISABLE_AUTO_UPDATE: "true" } });
112
+ const reason = "Automatic updates are disabled by the T3CODE_DISABLE_AUTO_UPDATE setting.";
113
+
114
+ return Effect.scoped(
115
+ Effect.gen(function* () {
116
+ const updates = yield* DesktopUpdates.DesktopUpdates;
117
+ yield* updates.configure;
118
+
119
+ const configured = yield* updates.getState;
120
+ assert.equal(configured.message, reason);
121
+
122
+ const changed = yield* updates.setChannel("nightly");
123
+ assert.equal(changed.channel, "nightly");
124
+ assert.equal(changed.enabled, false);
125
+ assert.equal(changed.status, "disabled");
126
+ assert.equal(changed.message, reason);
127
+ assert.equal(harness.sentStates.at(-1)?.message, reason);
128
+ assert.equal(harness.checkCount(), 0);
129
+ }),
130
+ ).pipe(Effect.provide(harness.layer));
131
+ });
132
+
133
it.effect("subscribe delivers the latest state plus subsequent changes", () => {
134
const harness = makeHarness();
135
apps/desktop/src/updates/DesktopUpdates.ts
+11
-11
@@ -273,13 +273,15 @@ function parseAppUpdateYml(raw: string): Effect.Effect<Option.Option<AppUpdateYm
273
274
function createBaseUpdateState(
275
channel: DesktopUpdateChannel,
276
- enabled: boolean,
276
+ disabledReason: Option.Option<string>,
277
environment: DesktopEnvironment.DesktopEnvironment["Service"],
278
): DesktopUpdateState {
279
+ const enabled = Option.isNone(disabledReason);
280
return {
281
...createInitialDesktopUpdateState(environment.appVersion, environment.runtimeInfo, channel),
282
enabled,
283
status: enabled ? "idle" : "disabled",
284
+ message: Option.getOrNull(disabledReason),
285
};
286
}
287
@@ -468,8 +470,6 @@ export const make = Effect.gen(function* () {
470
});
471
});
472
471
- const shouldEnableAutoUpdates = resolveDisabledReason.pipe(Effect.map(Option.isNone));
472
-
473
const checkForUpdates = Effect.fn("desktop.updates.checkForUpdates")(function* (
474
reason: string,
475
actionReservation: "acquire" | "held" = "acquire",
@@ -631,10 +631,10 @@ export const make = Effect.gen(function* () {
631
),
632
);
633
634
- const baseUpdateState = (channel: DesktopUpdateChannel, enabled: boolean) =>
634
+ const baseUpdateState = (channel: DesktopUpdateChannel, disabledReason: Option.Option<string>) =>
635
Ref.get(notAppliedVersionRef).pipe(
636
Effect.map((notAppliedVersion) => ({
637
- ...createBaseUpdateState(channel, enabled, environment),
637
+ ...createBaseUpdateState(channel, disabledReason, environment),
638
...Option.match(notAppliedVersion, {
639
onNone: () => ({}),
640
onSome: (version) => ({ notAppliedVersion: version }),
@@ -1056,9 +1056,9 @@ export const make = Effect.gen(function* () {
1056
}
1057
1058
const settings = yield* desktopSettings.get;
1059
- const enabled = yield* shouldEnableAutoUpdates;
1060
- yield* setState(yield* baseUpdateState(settings.updateChannel, enabled));
1061
- if (!enabled) {
1059
+ const disabledReason = yield* resolveDisabledReason;
1060
+ yield* setState(yield* baseUpdateState(settings.updateChannel, disabledReason));
1061
+ if (Option.isSome(disabledReason)) {
1062
return;
1063
}
1064
yield* Ref.set(updaterConfiguredRef, true);
@@ -1127,10 +1127,10 @@ export const make = Effect.gen(function* () {
1127
),
1128
);
1129
1130
- const enabled = yield* shouldEnableAutoUpdates;
1131
- yield* setState(yield* baseUpdateState(nextChannel, enabled));
1130
+ const disabledReason = yield* resolveDisabledReason;
1131
+ yield* setState(yield* baseUpdateState(nextChannel, disabledReason));
1132
1133
- if (!enabled || !(yield* Ref.get(updaterConfiguredRef))) {
1133
+ if (Option.isSome(disabledReason) || !(yield* Ref.get(updaterConfiguredRef))) {
1134
return yield* Ref.get(updateStateRef);
1135
}
1136
apps/web/src/components/desktopUpdate.logic.test.ts
+33
@@ -6,6 +6,8 @@ import {
6
getArm64IntelBuildWarningDescription,
7
getDesktopUpdateActionError,
8
getDesktopUpdateButtonTooltip,
9
+ getDesktopUpdateDisabledReason,
10
+ getDesktopUpdateIdleTooltip,
11
getDesktopUpdateInstallConfirmationMessage,
12
getDesktopUpdateReleaseHistoryUrl,
13
getDesktopUpdateReleaseUrl,
@@ -391,3 +393,34 @@ describe("getDesktopUpdateButtonTooltip", () => {
393
);
394
});
395
});
396
+
397
+describe("disabled update reason", () => {
398
+ const disabledState: DesktopUpdateState = {
399
+ ...baseState,
400
+ enabled: false,
401
+ status: "disabled",
402
+ message: "Automatic updates are only available in packaged production builds.",
403
+ };
404
+
405
+ it("explains why checking is unavailable", () => {
406
+ expect(getDesktopUpdateDisabledReason(disabledState)).toBe(
407
+ "Automatic updates are only available in packaged production builds.",
408
+ );
409
+ expect(getDesktopUpdateIdleTooltip(disabledState)).toEqual({
410
+ title: "Updates unavailable",
411
+ detail: "Automatic updates are only available in packaged production builds.",
412
+ });
413
+ expect(getDesktopUpdateDisabledReason({ ...disabledState, message: null })).toBe(
414
+ "Automatic updates are not available in this build.",
415
+ );
416
+ });
417
+
418
+ it("keeps the check prompt when updates are available", () => {
419
+ expect(getDesktopUpdateDisabledReason(baseState)).toBeNull();
420
+ expect(getDesktopUpdateDisabledReason(null)).toBeNull();
421
+ expect(getDesktopUpdateIdleTooltip(baseState)).toEqual({
422
+ title: "Check for updates",
423
+ detail: null,
424
+ });
425
+ });
426
+});
apps/web/src/components/desktopUpdate.logic.ts
+16
@@ -148,3 +148,19 @@ export function canCheckForUpdate(state: DesktopUpdateState | null): boolean {
148
state.status !== "checking" && state.status !== "downloading" && state.status !== "disabled"
149
);
150
}
151
+
152
+export function getDesktopUpdateDisabledReason(
153
+ state: Pick<DesktopUpdateState, "enabled" | "status" | "message"> | null,
154
+): string | null {
155
+ if (!state || (state.enabled && state.status !== "disabled")) return null;
156
+ return state.message?.trim() || "Automatic updates are not available in this build.";
157
+}
158
+
159
+export function getDesktopUpdateIdleTooltip(
160
+ state: Pick<DesktopUpdateState, "enabled" | "status" | "message"> | null,
161
+) {
162
+ const disabledReason = getDesktopUpdateDisabledReason(state);
163
+ return disabledReason
164
+ ? { title: "Updates unavailable", detail: disabledReason }
165
+ : { title: "Check for updates", detail: null };
166
+}
apps/web/src/components/settings/SettingsPanels.tsx
+2
-1
@@ -60,6 +60,7 @@ import { MobileAppSettingsRow } from "./MobileAppSettingsRow";
60
import {
61
canCheckForUpdate,
62
getDesktopUpdateButtonTooltip,
63
+ getDesktopUpdateDisabledReason,
64
getDesktopUpdateInstallConfirmationMessage,
65
isDesktopUpdateButtonDisabled,
66
resolveDesktopUpdateButtonAction,
@@ -419,7 +420,7 @@ function AboutVersionSection() {
420
const description =
421
action === "download" || action === "install"
422
? "Update available."
422
- : "Current version of the application.";
423
+ : (getDesktopUpdateDisabledReason(updateState) ?? "Current version of the application.");
424
425
return (
426
<>
apps/web/src/components/sidebar/SidebarUpdatePill.tsx
+13
-3
@@ -15,6 +15,7 @@ import {
15
getDesktopUpdateActionError,
16
getDesktopUpdateButtonTooltip,
17
getDesktopUpdateDownloadedVersion,
18
+ getDesktopUpdateIdleTooltip,
19
getDesktopUpdateInstallConfirmationMessage,
20
isDesktopUpdateButtonDisabled,
21
resolveDesktopUpdateButtonAction,
@@ -236,6 +237,8 @@ function SidebarUpdateControl() {
237
isDownloading,
238
showCheckIcon,
239
});
240
+ const idleTooltip =
241
+ !showUpdateDetails && !showCheckIcon ? getDesktopUpdateIdleTooltip(state) : null;
242
const tooltip = runsEverything
243
? everything.summary
244
: showUpdateDetails
@@ -244,7 +247,7 @@ function SidebarUpdateControl() {
247
: "Update available"
248
: showCheckIcon
249
? "Checking for updates…"
247
- : "Check for updates";
250
+ : (idleTooltip?.title ?? "Check for updates");
251
const disabled = showCheckIcon
252
? true
253
: runsEverything
@@ -441,7 +444,7 @@ function SidebarUpdateControl() {
444
const updateButton = (
445
<button
446
type="button"
444
- aria-label={tooltip}
447
+ aria-label={idleTooltip?.detail ? `${tooltip}: ${idleTooltip.detail}` : tooltip}
448
aria-disabled={isInteractionDisabled || undefined}
449
className={cn(
450
"inline-flex size-8 items-center justify-center rounded-full outline-hidden ring-ring transition-colors focus-visible:ring-2 focus-visible:ring-inset",
@@ -520,7 +523,14 @@ function SidebarUpdateControl() {
523
side="top"
524
variant={showUpdateDetails ? "glass" : "default"}
525
>
523
- <span className="whitespace-pre-line">{tooltip}</span>
526
+ {idleTooltip?.detail ? (
527
+ <div className="text-left">
528
+ <div className="font-medium">{idleTooltip.title}</div>
529
+ <div className="text-muted-foreground">{idleTooltip.detail}</div>
530
+ </div>
531
+ ) : (
532
+ <span className="whitespace-pre-line">{tooltip}</span>
533
+ )}
534
</TooltipPopup>
535
) : null}
536
</Tooltip>