From bab9752c8b9ed454d9660ea624a0e8740ff9b0a1 Mon Sep 17 00:00:00 2001 From: Will Miao Date: Mon, 13 Jul 2026 11:29:47 +0800 Subject: [PATCH] fix(download): close modal before progress overlay and fix downloadId ReferenceError on cancel --- static/js/managers/DownloadManager.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/static/js/managers/DownloadManager.js b/static/js/managers/DownloadManager.js index a780f5b2..18ebe63b 100644 --- a/static/js/managers/DownloadManager.js +++ b/static/js/managers/DownloadManager.js @@ -882,13 +882,12 @@ export class DownloadManager { let ws = null; let updateProgress = () => { }; let cancelled = false; + const downloadId = Date.now().toString(); try { this.loadingManager.restoreProgressBar(); updateProgress = this.loadingManager.showDownloadProgress(1); updateProgress(0, 0, displayName); - - const downloadId = Date.now().toString(); const wsProtocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://'; ws = new WebSocket(`${wsProtocol}${window.location.host}/ws/download-progress?id=${downloadId}`); @@ -1501,6 +1500,8 @@ export class DownloadManager { this.currentVersion?.id, (this.currentVersion?.files || []).length); } + modalManager.closeModal('downloadModal'); + return this.executeDownloadWithProgress({ modelId: this.modelId, versionId: this.currentVersion.id,