Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/renderer/components/settings-electron.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export const ElectronSettings = observer(
buttonProps.onClick = () => {
isLocal
? appState.removeVersion(ver)
: appState.downloadVersion(ver);
: appState.downloadVersion(ver, { activate: false });
};
break;
}
Expand Down
23 changes: 19 additions & 4 deletions src/renderer/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,12 +577,18 @@ export class AppState {
}

/**
* Download a version of Electron.
* Download a version of Electron and set it as the current
* version in use unless otherwise specified.
*
* @param {RunnableVersion} ver
* @param {Object} opts
* @param {Boolean} [options.activate=true] - Whether to set ver as current
* @returns {Promise<void>}
*/
public async downloadVersion(ver: RunnableVersion) {
public async downloadVersion(
ver: RunnableVersion,
opts: { activate: boolean } = { activate: true },
) {
const { source, state, version } = ver;
const {
electronMirror,
Expand Down Expand Up @@ -611,7 +617,8 @@ export class AppState {
}

console.log(`State: Downloading Electron ${version}`);
await this.installer.install(version, {

const options = {
mirror: {
electronMirror,
electronNightlyMirror,
Expand All @@ -625,7 +632,15 @@ export class AppState {
}
});
},
});
};

// Download the version without setting it as the current version.
if (!opts.activate) {
await this.installer.ensureDownloaded(version, options);
return;
}

await this.installer.install(version, options);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function getVersions(
* Save an array of GitHubVersions to localStorage.
*
* @param {VersionKeys} key
* @param {Array<Version} versions
* @param {Array<Version>} versions
*/
function saveVersions(key: VersionKeys, versions: Array<Version>) {
const stringified = JSON.stringify(versions);
Expand Down