Skip to content

Commit

Permalink
Fix stuck loading progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
mkkellogg committed Mar 7, 2024
1 parent 99c5eaf commit 06f08e6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ export class Viewer {
let loadingTaskId = null;
if (showLoadingUI) loadingTaskId = this.loadingSpinner.addTask('Downloading...');

let downloadDone = false;

let loadedPercent = 0;
const onProgress = (percent, percentLabel, loaderStatus) => {
loadedPercent = percent;
Expand Down Expand Up @@ -506,12 +508,16 @@ export class Viewer {
if (firstBuild && streamBuildSections || finalBuild && !streamBuildSections) {
this.runAfterFirstSort.push(() => {
this.loadingSpinner.removeTask(loadingTaskId);
if (!finalBuild) this.loadingProgressBar.show();
if (!finalBuild && !downloadDone) this.loadingProgressBar.show();
});
}
if (streamBuildSections) {
if (finalBuild) this.loadingProgressBar.hide();
else this.loadingProgressBar.setProgress(loadedPercent);
if (finalBuild) {
downloadDone = true;
this.loadingProgressBar.hide();
} else {
this.loadingProgressBar.setProgress(loadedPercent);
}
}
}
});
Expand Down

0 comments on commit 06f08e6

Please sign in to comment.