Skip to content

Commit 06f08e6

Browse files
committed
Fix stuck loading progress bar
1 parent 99c5eaf commit 06f08e6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Viewer.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@ export class Viewer {
473473
let loadingTaskId = null;
474474
if (showLoadingUI) loadingTaskId = this.loadingSpinner.addTask('Downloading...');
475475

476+
let downloadDone = false;
477+
476478
let loadedPercent = 0;
477479
const onProgress = (percent, percentLabel, loaderStatus) => {
478480
loadedPercent = percent;
@@ -506,12 +508,16 @@ export class Viewer {
506508
if (firstBuild && streamBuildSections || finalBuild && !streamBuildSections) {
507509
this.runAfterFirstSort.push(() => {
508510
this.loadingSpinner.removeTask(loadingTaskId);
509-
if (!finalBuild) this.loadingProgressBar.show();
511+
if (!finalBuild && !downloadDone) this.loadingProgressBar.show();
510512
});
511513
}
512514
if (streamBuildSections) {
513-
if (finalBuild) this.loadingProgressBar.hide();
514-
else this.loadingProgressBar.setProgress(loadedPercent);
515+
if (finalBuild) {
516+
downloadDone = true;
517+
this.loadingProgressBar.hide();
518+
} else {
519+
this.loadingProgressBar.setProgress(loadedPercent);
520+
}
515521
}
516522
}
517523
});

0 commit comments

Comments
 (0)