From 5be4043f734eff1b23ebd927b63902034d4691c6 Mon Sep 17 00:00:00 2001 From: MontaGhanmy Date: Mon, 10 Mar 2025 09:33:12 +0100 Subject: [PATCH] fix: resetting root on re-upload --- .../features/files/services/file-upload-service.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tdrive/frontend/src/app/features/files/services/file-upload-service.ts b/tdrive/frontend/src/app/features/files/services/file-upload-service.ts index 444fedb0..ebc78f20 100644 --- a/tdrive/frontend/src/app/features/files/services/file-upload-service.ts +++ b/tdrive/frontend/src/app/features/files/services/file-upload-service.ts @@ -63,7 +63,7 @@ class FileUploadService { async _waitWhilePaused(id?: string) { logger.debug('===== _waitWhilePaused ======'); logger.debug('rootStates: ', this.rootStates); - logger.debug('status: ', this.uploadStatus) + logger.debug('status: ', this.uploadStatus); while (this.uploadStatus === UploadStateEnum.Paused || (id && this.rootStates.paused[id])) { if (this.uploadStatus === UploadStateEnum.Cancelled || (id && this.rootStates.cancelled[id])) return; @@ -283,6 +283,13 @@ class FileUploadService { return { [key]: root[key] }; }); + // Reset existing uploads + for (const rootKey of rootKeys) { + if (rootKey in this.groupIds) { + this.resetStates([rootKey]); + } + } + // tree promises const treePromises = rootTrees.map(tree => { return traverserTreeLevel(tree, context.parentId, true); @@ -308,7 +315,7 @@ class FileUploadService { ): Promise { logger.debug('===== upload ====='); logger.debug('uploadStatus: ', this.uploadStatus); - + // reset the upload status when creating a new document if (fileList.length === 1 && fileList[0].root === fileList[0].file.name) { if (this.uploadStatus === UploadStateEnum.Paused) {