Skip to content

Commit

Permalink
fix one more ui bug around downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
wkelly17 committed Oct 10, 2024
1 parent f3d141e commit c09594c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 4 additions & 5 deletions src/components/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,10 @@ export function Settings(props: ISettings) {
}
}
function breakLoop() {
if (window.dotAppStopAllDownloads) {
if (window.dotAppStopAllDownloads || bookDownloadRequestIsAborted()) {
props.setIsSavingSingle([]);
return true;
}
if (bookDownloadRequestIsAborted()) {
return true;
}
return false;
}

Expand All @@ -146,7 +143,6 @@ export function Settings(props: ISettings) {
fetchNum += 1;
}
}

const result =
await vidSaver.aggregateWipBlobsIntoOneAndWriteFs(allExpectedChunks);
// todo maybe?: some error handling here? Returning here is fine right now, the jobs that called it just assumes the download completed, the state is read from fs as source of truth (so no falsy UI since we don't actually combine the final blob). This right now just means that some fetch went wrong (don't know why), but if the job is started again from here, well, no big problem.
Expand Down Expand Up @@ -195,6 +191,9 @@ export function Settings(props: ISettings) {
vidName: vid.name || "",
vidId: vid.id || "",
});
window.dotAppBooksToCancel = [];
window.dotAppStopAllDownloads = false;
props.setIsSavingSingle((prev) => prev.filter((id) => id !== vid.id));
}, 1000);
}
async function handleSingleVidDelete(vid: IVidWithCustom) {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Settings/BulkListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ export function BulkListing({
await saveVidOffline(vidChapter, currentPlaylistData);
}
}

setTimeout(() => {
setDownloadProgress({
amount: 0,
Expand All @@ -169,12 +168,13 @@ export function BulkListing({
vidId: currentVid.id || "",
});
// reset selection when action is finished
window.dotAppBooksToCancel = [];
window.dotAppStopAllDownloads = false;
setBooksSelected(undefined);
setBookNamesSelected([]);
}, 1000);
window.dotAppBooksToCancel = [];
window.dotAppStopAllDownloads = false;
}

async function deleteSelectedBooks(books?: IVidWithCustom[][]) {
const booksToUse = books ? books : booksSelected;
if (!booksToUse) return;
Expand Down

0 comments on commit c09594c

Please sign in to comment.