[eric] updates: opting out of experimental builds offers the current stable even though it is a downgrade, so a tester is never stranded on a prerelease

This commit is contained in:
ciregenz
2026-08-10 10:17:32 -07:00
parent ade1207d86
commit de1915e20f
+5 -1
View File
@@ -3672,7 +3672,11 @@ ipcMain.handle('set-allow-prerelease', async (_e, value) => {
// Built-in autoUpdater has no allowPrerelease; experimental channel on Windows is a TODO once we wire a separate Squirrel prerelease feed.
if (isSquirrelUpdater) return { success: false, error: 'Experimental channel not yet supported on Windows Squirrel target' };
const next = Boolean(value);
if (autoUpdater.allowPrerelease === next) return { success: true, changed: false };
// Opting OUT while running an experimental build must offer the CURRENT stable, which is a semver downgrade; without this a tester who flips the toggle off is stranded on the prerelease until the next stable overtakes it.
const wantDowngrade = !next && String(app.getVersion()).includes('-');
const downgradeChanged = autoUpdater.allowDowngrade !== wantDowngrade;
autoUpdater.allowDowngrade = wantDowngrade;
if (autoUpdater.allowPrerelease === next && !downgradeChanged) return { success: true, changed: false };
autoUpdater.allowPrerelease = next;
if (!isPackaged) return { success: true, changed: true };
try {