Show desktop update check feedback (#1808)
* fix(desktop): show app update check feedback Manual desktop app update checks now leave visible status feedback even when the shared update state is pending or available. Updater check and preparation errors are carried through the existing result path so the settings row and callout can show the failure instead of only logging it. * fix(desktop): make update retries perform fresh checks Manual retries now clear runtime errors emitted by a failed check so the next click calls the updater again. Background checks also skip while a visible manual check is active, and last-checked update copy uses complete localized strings. * fix(desktop): punctuate update check timestamp copy * fix(desktop): share runtime update errors * fix(desktop): preserve update preparation errors * fix(desktop): settle update check review races * fix(desktop): settle quiet update check errors * fix(desktop): handle overlapping update checks * fix(desktop): preserve preparation errors during checks
This commit is contained in:
@@ -137,13 +137,30 @@ export function formatStatusText(input: {
|
||||
}
|
||||
|
||||
if (status === "pending") {
|
||||
if (lastCheckedAt != null) {
|
||||
return i18n.t("desktop.updates.status.pendingWithLastChecked", {
|
||||
time: formatLastCheckedAt(lastCheckedAt),
|
||||
});
|
||||
}
|
||||
return i18n.t("desktop.updates.status.pending");
|
||||
}
|
||||
|
||||
if (status === "available") {
|
||||
if (availableUpdate?.latestVersion) {
|
||||
return i18n.t("desktop.updates.status.availableWithVersion", {
|
||||
version: formatVersion(availableUpdate.latestVersion),
|
||||
return i18n.t(
|
||||
lastCheckedAt != null
|
||||
? "desktop.updates.status.availableWithVersionAndLastChecked"
|
||||
: "desktop.updates.status.availableWithVersion",
|
||||
{
|
||||
version: formatVersion(availableUpdate.latestVersion),
|
||||
time: lastCheckedAt != null ? formatLastCheckedAt(lastCheckedAt) : undefined,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
if (lastCheckedAt != null) {
|
||||
return i18n.t("desktop.updates.status.availableWithLastChecked", {
|
||||
time: formatLastCheckedAt(lastCheckedAt),
|
||||
});
|
||||
}
|
||||
return i18n.t("desktop.updates.status.available");
|
||||
@@ -182,13 +199,17 @@ export function createDesktopAppUpdater(deps: DesktopAppUpdaterDeps): DesktopApp
|
||||
return null;
|
||||
}
|
||||
const { releaseChannel, intent = "manual", silent = false } = options;
|
||||
if (silent && state.status === "checking") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const requestVersion = state.requestVersion + 1;
|
||||
|
||||
commit({
|
||||
...state,
|
||||
requestVersion,
|
||||
status: silent ? state.status : "checking",
|
||||
errorMessage: null,
|
||||
errorMessage: silent ? state.errorMessage : null,
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -197,7 +218,24 @@ export function createDesktopAppUpdater(deps: DesktopAppUpdaterDeps): DesktopApp
|
||||
return result;
|
||||
}
|
||||
|
||||
const nextLastCheckedAt = deps.now();
|
||||
const nextLastCheckedAt = intent === "manual" ? deps.now() : state.lastCheckedAt;
|
||||
if (result.errorMessage) {
|
||||
if (silent && !result.hasUpdate) {
|
||||
console.warn("[DesktopUpdater] Silent update check failed", result.errorMessage);
|
||||
return result;
|
||||
}
|
||||
|
||||
commit({
|
||||
...state,
|
||||
status: "error",
|
||||
availableUpdate: null,
|
||||
errorMessage: result.errorMessage,
|
||||
installMessage: null,
|
||||
lastCheckedAt: nextLastCheckedAt,
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
let nextStatus: DesktopAppUpdateStatus;
|
||||
let nextAvailable: DesktopAppUpdateCheckResult | null;
|
||||
|
||||
@@ -216,6 +254,7 @@ export function createDesktopAppUpdater(deps: DesktopAppUpdaterDeps): DesktopApp
|
||||
...state,
|
||||
status: nextStatus,
|
||||
availableUpdate: nextAvailable,
|
||||
errorMessage: null,
|
||||
installMessage: null,
|
||||
lastCheckedAt: nextLastCheckedAt,
|
||||
});
|
||||
@@ -229,12 +268,12 @@ export function createDesktopAppUpdater(deps: DesktopAppUpdaterDeps): DesktopApp
|
||||
const message = getErrorMessage(error);
|
||||
if (silent) {
|
||||
console.warn("[DesktopUpdater] Silent update check failed", message);
|
||||
commit({ ...state });
|
||||
} else {
|
||||
commit({
|
||||
...state,
|
||||
status: "error",
|
||||
errorMessage: message,
|
||||
lastCheckedAt: intent === "manual" ? deps.now() : state.lastCheckedAt,
|
||||
});
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user