From 06f08e655ec4fe65b209701775322fce59fa16fb Mon Sep 17 00:00:00 2001 From: Mark Kellogg Date: Thu, 7 Mar 2024 15:19:36 -0800 Subject: [PATCH] Fix stuck loading progress bar --- src/Viewer.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Viewer.js b/src/Viewer.js index aea1efea..96bbb5db 100644 --- a/src/Viewer.js +++ b/src/Viewer.js @@ -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; @@ -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); + } } } });