authorgravatar for 92423096+nateEc@users.noreply.github.comYukun Shan <92423096+nateEc@users.noreply.github.com> 2026-07-23 20:36:56+08:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-07-23 14:36:56+02:00
logb41e89eba9cd232cc3257b400fc30972a9b53438
tree4aacab2ef2437fa2a9e61dd8c631a0d96f39f51f
parent4d83436415c0f6020afe84c127b88874b6f0103c
signature Signed by PGP key B5690EEEBB952194

fix(web): warn before silent Windows updates (#4350)


5 files changed, 37 insertions(+), 3 deletions(-)

apps/web/src/components/Sidebar.tsx+1-1
......@@ -3608,7 +3608,7 @@ export default function Sidebar() {
36083608
36093609 if (desktopUpdateButtonAction === "install") {
36103610 const confirmed = window.confirm(
3611 getDesktopUpdateInstallConfirmationMessage(desktopUpdateState),
3611 getDesktopUpdateInstallConfirmationMessage(desktopUpdateState, navigator.platform),
36123612 );
36133613 if (!confirmed) return;
36143614 void bridge
apps/web/src/components/desktopUpdate.logic.test.ts+26
......@@ -225,6 +225,32 @@ describe("desktop update UI helpers", () => {
225225 }),
226226 ).toContain("Install update and restart T3 Code?");
227227 });
228
229 it("warns Windows users that a silent installation can take several minutes", () => {
230 const message = getDesktopUpdateInstallConfirmationMessage(
231 {
232 availableVersion: "1.1.0",
233 downloadedVersion: "1.1.0",
234 },
235 "Win32",
236 );
237
238 expect(message).toContain("may remain closed for several minutes");
239 expect(message).toContain("no installer window may appear");
240 expect(message).toContain("will reopen automatically");
241 });
242
243 it("keeps the additional silent installation warning Windows-specific", () => {
244 const message = getDesktopUpdateInstallConfirmationMessage(
245 {
246 availableVersion: "1.1.0",
247 downloadedVersion: "1.1.0",
248 },
249 "MacIntel",
250 );
251
252 expect(message).not.toContain("may remain closed for several minutes");
253 });
228254});
229255
230256describe("canCheckForUpdate", () => {
apps/web/src/components/desktopUpdate.logic.ts+6-1
......@@ -1,4 +1,5 @@
11import type { DesktopUpdateActionResult, DesktopUpdateState } from "@t3tools/contracts";
2import { isWindowsPlatform } from "../lib/utils";
23
34export type DesktopUpdateButtonAction = "download" | "install" | "none";
45
......@@ -78,9 +79,13 @@ export function getDesktopUpdateButtonTooltip(state: DesktopUpdateState): string
7879
7980export function getDesktopUpdateInstallConfirmationMessage(
8081 state: Pick<DesktopUpdateState, "availableVersion" | "downloadedVersion">,
82 platform = "",
8183): string {
8284 const version = state.downloadedVersion ?? state.availableVersion;
83 return `Install update${version ? ` ${version}` : ""} and restart T3 Code?\n\nAny running tasks will be interrupted. Make sure you're ready before continuing.`;
85 const windowsInstallWarning = isWindowsPlatform(platform)
86 ? "\n\nOn Windows, T3 Code may remain closed for several minutes while the update installs, and no installer window may appear. T3 Code will reopen automatically when installation finishes."
87 : "";
88 return `Install update${version ? ` ${version}` : ""} and restart T3 Code?\n\nAny running tasks will be interrupted. Make sure you're ready before continuing.${windowsInstallWarning}`;
8489}
8590
8691export function getDesktopUpdateActionError(result: DesktopUpdateActionResult): string | null {
apps/web/src/components/settings/SettingsPanels.tsx+1
......@@ -233,6 +233,7 @@ function AboutVersionSection() {
233233 const confirmed = window.confirm(
234234 getDesktopUpdateInstallConfirmationMessage(
235235 updateState ?? { availableVersion: null, downloadedVersion: null },
236 navigator.platform,
236237 ),
237238 );
238239 if (!confirmed) return;
apps/web/src/components/sidebar/SidebarUpdatePill.tsx+3-1
......@@ -110,7 +110,9 @@ export function SidebarUpdatePill() {
110110 }
111111
112112 if (action === "install") {
113 const confirmed = window.confirm(getDesktopUpdateInstallConfirmationMessage(state));
113 const confirmed = window.confirm(
114 getDesktopUpdateInstallConfirmationMessage(state, navigator.platform),
115 );
114116 if (!confirmed) return;
115117 void bridge
116118 .installUpdate()