Skip to content

Add Cancel Download All Versions #1402

@dsanders11

Description

@dsanders11

This is similar to #1016 but should be easier to implement since we don't need @electron/get support for canceling an individual download. Currently if you click "Download All Versions" there's no way to cancel that, which is pretty bad since that can be hundreds of downloads. The only way to cancel is to quit the app.

This shouldn't be too difficult to fix, in the for loop which downloads all versions we should just check if isDownloadingAll is still true after each download and break if it's not. The other change would be when isDownloadingAll is true, render a "Stop Downloads" button in place of the "Download All Versions" button, and clicking that will set isDownloadingAll to false.

It will need to move isDownloadingAll to AppState as well (isDeletingAll too) since downloads continue after the user leaves settings, and it would probably be confusing if switching settings tabs or leaving settings stopped the downloads. Currently leaving the settings tab means the isDownloadingAll state is lost and the button could be clicked again or "Remove All Versions" could be clicked, so moving the state to AppState will fix that.

public async handleDownloadAll(): Promise<void> {
this.setState({ isDownloadingAll: true });
const { downloadVersion, versionsToShow } = this.props.appState;
for (const ver of versionsToShow) {
await downloadVersion(ver);
}
this.setState({ isDownloadingAll: false });
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions