@devries-cameron20 / t3code-1 / commits / cd2b885b77
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): Connections no longer says "Up to date" while a desktop update is pending (#14790)

Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

Igor Makowski committed Oct 20, 2026 at 04:48 UTC cd2b885b77d3df0aedf8a2cfd6ecf355e7815ea0
3 files changed +109 -2
apps/web/src/components/settings/ConnectionsSettings.logic.test.ts
+59 -1
@@ -1,4 +1,4 @@
1 -import type { AdvertisedEndpoint, DesktopWslState } from "@t3tools/contracts";
1 +import type { AdvertisedEndpoint, DesktopUpdateState, DesktopWslState } from "@t3tools/contracts";
2 import { describe, expect, it, vi } from "vite-plus/test";
3 import {
4 applyWslEnableSelection,
@@ -6,6 +6,7 @@ import {
6 isQrShareableEndpoint,
7 isWslSettingsRowVisible,
8 missingTailscaleEndpointDescription,
9 + resolveLocalVersionStatusLabel,
10 selectQrEndpointOption,
11 togglePairingScopeSelection,
12 } from "./ConnectionsSettings.logic";
@@ -54,6 +55,63 @@ const baseWslState: DesktopWslState = {
55 preflightError: null,
56 };
57
58 +describe("resolveLocalVersionStatusLabel", () => {
59 + const baseState: DesktopUpdateState = {
60 + enabled: true,
61 + status: "idle",
62 + channel: "latest",
63 + currentVersion: "1.0.0",
64 + hostArch: "x64",
65 + appArch: "x64",
66 + runningUnderArm64Translation: false,
67 + availableVersion: null,
68 + downloadedVersion: null,
69 + releaseNotes: [],
70 + omittedReleaseCount: 0,
71 + downloadPercent: null,
72 + checkedAt: null,
73 + message: null,
74 + errorContext: null,
75 + canRetry: false,
76 + };
77 +
78 + it("stays up to date on the web and when the desktop updater has nothing pending", () => {
79 + expect(resolveLocalVersionStatusLabel(null)).toBe("Up to date");
80 + expect(resolveLocalVersionStatusLabel(baseState)).toBe("Up to date");
81 + });
82 +
83 + it.each<[string, Partial<DesktopUpdateState>, string]>([
84 + ["available", { status: "available", availableVersion: "1.2.0" }, "Update 1.2.0 available"],
85 + [
86 + "downloading",
87 + { status: "downloading", availableVersion: "1.2.0" },
88 + "Downloading update 1.2.0",
89 + ],
90 + [
91 + "downloaded",
92 + { status: "downloaded", availableVersion: "1.2.0", downloadedVersion: "1.1.0" },
93 + "Update 1.1.0 downloaded",
94 + ],
95 + [
96 + "a failed download that can be retried",
97 + { status: "error", errorContext: "download", availableVersion: "1.2.0", canRetry: true },
98 + "Update 1.2.0 available",
99 + ],
100 + [
101 + "a failed install",
102 + { status: "error", errorContext: "install", downloadedVersion: "1.1.0" },
103 + "Update 1.1.0 downloaded",
104 + ],
105 + [
106 + "a recheck that keeps a downloaded update",
107 + { status: "checking", downloadedVersion: "1.1.0" },
108 + "Update 1.1.0 downloaded",
109 + ],
110 + ])("names the pending update for %s", (_, state, label) => {
111 + expect(resolveLocalVersionStatusLabel({ ...baseState, ...state })).toBe(label);
112 + });
113 +});
114 +
115 describe("isWslSettingsRowVisible", () => {
116 it("shows the retry row when the WSL state failed to load", () => {
117 expect(isWslSettingsRowVisible({ state: null, error: "load failed" })).toBe(true);
apps/web/src/components/settings/ConnectionsSettings.logic.ts
+37
@@ -5,8 +5,13 @@ import {
5 AuthTerminalReadScope,
6 type DesktopBridge,
7 type DesktopServerExposureState,
8 + type DesktopUpdateState,
9 type DesktopWslState,
10 } from "@t3tools/contracts";
11 +import {
12 + getDesktopUpdateDownloadedVersion,
13 + resolveDesktopUpdateButtonAction,
14 +} from "../desktopUpdate.logic";
15
16 /**
17 * Operating terminals without being able to list them leaves a client
@@ -70,6 +75,38 @@ export function isWslSettingsRowVisible(input: {
75 return state ? state.available || state.enabled || state.wslOnly : error !== null;
76 }
77
78 +/**
79 + * Passive label for this machine's Version row once client and server versions
80 + * match. The desktop bundles its server, so a pending app update is the only
81 + * way it falls behind. Pending states follow the sidebar update control's
82 + * action, including retryable failures, so the two never disagree; the sidebar
83 + * is where to act. A recheck keeps a downloaded update while `checking`, so it
84 + * keeps its label too. `state` is null outside the desktop app.
85 + */
86 +export function resolveLocalVersionStatusLabel(state: DesktopUpdateState | null): string {
87 + if (!state) return "Up to date";
88 + if (state.status === "downloading") {
89 + return state.availableVersion
90 + ? `Downloading update ${state.availableVersion}`
91 + : "Downloading update";
92 + }
93 + const action = resolveDesktopUpdateButtonAction(state);
94 + if (
95 + action === "install" ||
96 + state.status === "downloaded" ||
97 + (state.status === "checking" && state.downloadedVersion !== null)
98 + ) {
99 + const version = getDesktopUpdateDownloadedVersion(state);
100 + return version ? `Update ${version} downloaded` : "Update downloaded";
101 + }
102 + if (action === "download") {
103 + return state.availableVersion
104 + ? `Update ${state.availableVersion} available`
105 + : "Update available";
106 + }
107 + return "Up to date";
108 +}
109 +
110 export type QrEndpointOption = {
111 readonly id: string;
112 /**
apps/web/src/components/settings/ConnectionsSettings.tsx
+13 -1
@@ -71,6 +71,7 @@ import {
71 isQrShareableEndpoint,
72 isWslSettingsRowVisible,
73 missingTailscaleEndpointDescription,
74 + resolveLocalVersionStatusLabel,
75 selectQrEndpointOption,
76 togglePairingScopeSelection,
77 } from "./ConnectionsSettings.logic";
@@ -176,6 +177,7 @@ import {
177 } from "~/state/desktopNetworkAccess";
178 import { desktopSshHostsStateAtom, filterDiscoveredSshHosts } from "~/state/desktopSshHosts";
179 import { desktopWslStateAtom, refreshDesktopWslState } from "~/state/desktopWslState";
180 +import { useDesktopUpdateState } from "~/state/desktopUpdate";
181 import {
182 type EnvironmentPresentation,
183 useEnvironments,
@@ -2003,6 +2005,16 @@ function CloudRemoteEnvironmentRows({
2005 ) : null;
2006 }
2007
2008 +// Subscribes on its own so desktop download progress does not re-render the page.
2009 +function LocalVersionStatusLabel() {
2010 + const updateState = useDesktopUpdateState();
2011 + return (
2012 + <span className="text-xs text-muted-foreground">
2013 + {resolveLocalVersionStatusLabel(updateState)}
2014 + </span>
2015 + );
2016 +}
2017 +
2018 export function ConnectionsSettings() {
2019 const desktopBridge = window.desktopBridge;
2020 const keybindings = useAtomValue(primaryServerKeybindingsAtom);
@@ -3470,7 +3482,7 @@ export function ConnectionsSettings() {
3482 }
3483 />
3484 ) : primaryServerUpdateState.status === "idle" && primaryServerConfig ? (
3473 - <span className="text-xs text-muted-foreground">Up to date</span>
3485 + <LocalVersionStatusLabel />
3486 ) : undefined
3487 }
3488 />