@@ -390,6 +390,8 @@ export const make = Effect.gen(function* () {
390390 const failedDownloads = new Set < string > ( ) ;
391391 // Manual checks can clear downloadedVersion while the native installer stays queued.
392392 let downloadedInstallerVersion : string | null = null ;
393+ // electron-updater emits update-downloaded before downloadUpdate resolves.
394+ let downloadEventSeen = false ;
393395 const notAppliedVersionRef = yield * Ref . make ( Option . none < string > ( ) ) ;
394396 // The release a track switch's database check cleared. A build crosses to another track only
395397 // through such a switch, and never below that release: version order alone cannot tell whether
@@ -630,8 +632,10 @@ export const make = Effect.gen(function* () {
630632 environment . platform !== "darwin" && ! isDebPackage ,
631633 ) ;
632634 downloadedInstallerVersion = null ;
635+ downloadEventSeen = false ;
633636 yield * electronUpdater . downloadUpdate ;
634- downloadedInstallerVersion ??= state . availableVersion ;
637+ // The event handler may have rejected an off-track download; keep its decision.
638+ if ( ! downloadEventSeen ) downloadedInstallerVersion ??= state . availableVersion ;
635639 if ( downloadedInstallerVersion !== null ) failedDownloads . delete ( downloadedInstallerVersion ) ;
636640 return { accepted : true , completed : true } ;
637641 } ) . pipe (
@@ -1118,6 +1122,7 @@ export const make = Effect.gen(function* () {
11181122 yield * decodeUpdateInfo ( raw ) . pipe (
11191123 Effect . flatMap (
11201124 Effect . fn ( "desktop.updates.applyUpdateDownloaded" ) ( function * ( info ) {
1125+ downloadEventSeen = true ;
11211126 const state = yield * Ref . get ( updateStateRef ) ;
11221127 // A download can finish after its track switch moved on; never offer that build.
11231128 if ( ! ( yield * offerable ( info . version , state ) ) ) {
0 commit comments