fix(desktop): fix manual update wording and retry Velopack (#3261)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-08 00:04:58 +02:00
1 parent 5c63d81ffd
commit 2e3e3a1536
3 files changed
+52 -4

No files matched your search

@@ -159,7 +159,7 @@ export const UpdaterIcon = observer(() => {
: i18n._(DOWNLOADING_UPDATE_2_DESCRIPTOR, {percent});
}
if (Platform.isElectron && (store.nativeAwaitingDownload || store.nativeManualUpdateAvailable)) {
if (store.nativeManualUpdateAvailable) {
if (store.nativeManualUpdateAvailable && store.nativeManualDownloadOptions.length > 0) {
return version ? i18n._(CHOOSE_LINUX_PACKAGE_DESCRIPTOR, {version}) : i18n._(CHOOSE_LINUX_PACKAGE_2_DESCRIPTOR);
}
const size = store.updateInfo.native.downloadSize;
@@ -188,6 +188,7 @@ export const UpdaterIcon = observer(() => {
store.nativeAwaitingDownload,
store.nativeDownloadInFlight,
store.nativeDownloadProgressSupported,
store.nativeManualDownloadOptions,
store.nativeManualUpdateAvailable,
store.nativeUpdateReady,
store.updateInfo.native.downloadSize,
+32
View File
@@ -547,6 +547,38 @@ describe('Updater Windows apply failures', () => {
assert.equal(updater.applyState.attempt.version, PUBLISHED_VERSION);
});
test('keeps offering the installer when no newer release than the failed one is out', async () => {
const updater = loadWindowsUpdater({
installedVersion: CURRENT_VERSION,
remoteUpdate: {Version: PUBLISHED_VERSION, Size: 100},
applyAttempt: {version: PUBLISHED_VERSION, attemptedAt: 0},
});
await updater.check();
assert.deepEqual(types(updater.events), ['checking', 'error', 'available']);
assert.equal(updater.events[2].downloadStarted, false);
assert.equal(updater.applyState.cleared, 0);
});
test('retries the in-app update when a newer release than the failed one is out', async () => {
const newerVersion = '2026.905.101010';
const updater = loadWindowsUpdater({
installedVersion: CURRENT_VERSION,
pendingRestart: {Version: PUBLISHED_VERSION, Size: 100},
remoteUpdate: {Version: newerVersion, Size: 200},
applyAttempt: {version: PUBLISHED_VERSION, attemptedAt: 0},
});
await updater.check();
assert.equal(updater.applyState.cleared, 1);
assert.equal(updater.applyState.attempt, null);
assert.deepEqual(types(updater.events), ['checking', 'available']);
assert.equal(updater.events[1].version, newerVersion);
assert.equal(updater.events[1].downloadUrl, undefined);
});
test('resumes normal updates once the installed version catches up', async () => {
const updater = loadWindowsUpdater({
installedVersion: PUBLISHED_VERSION,
+18 -3
View File
@@ -218,12 +218,27 @@ async function checkVelopackForUpdates(
send(getMainWindow(), {type: 'checking', context});
const updateManager = createVelopackUpdateManager();
const failedApply = resolveFailedVelopackApply(updateManager);
if (failedApply) {
let update: Awaited<ReturnType<VelopackUpdateManager['checkForUpdatesAsync']>>;
try {
update = await updateManager.checkForUpdatesAsync();
} catch (error) {
if (!failedApply) throw error;
await sendVelopackApplyFailure(context, getMainWindow, failedApply);
return;
}
const pendingUpdate = updateManager.getUpdatePendingRestart();
const update = await updateManager.checkForUpdatesAsync();
if (failedApply) {
const updateVersion = update ? getVelopackUpdateVersion(update) : null;
if (!updateVersion || compareVersions(updateVersion, failedApply.version) <= 0) {
await sendVelopackApplyFailure(context, getMainWindow, failedApply);
return;
}
log.info('A release newer than the update that failed to apply is out, retrying the in-app update', {
failedVersion: failedApply.version,
updateVersion,
});
clearVelopackApplyAttempt();
}
const pendingUpdate = failedApply ? null : updateManager.getUpdatePendingRestart();
if (!update) {
if (pendingUpdate) {
pendingVelopackUpdate = pendingUpdate;