🐛Fixed "folder size isn't displayed after the upload"

This commit is contained in:
Anton SHEPILOV
2024-07-22 15:02:11 +02:00
committed by ericlinagora
parent 881eb6515a
commit 6ce005f882
@@ -55,8 +55,13 @@ export const useDriveUpload = () => {
// Upload files into directories
logger.debug("Start file uploading")
//create counter to calculate number of uploaded files, and refresh browsing window only when all the files were uploaded
let expectedUploadsCount = 0;
const parentFolder = context.parentId;
let uploadedFilesCount = 0;
for (const parentId of Object.keys(filesPerParentId)) {
logger.debug(`Upload files for directory ${parentId}`);
expectedUploadsCount += filesPerParentId[parentId].length;
await FileUploadService.upload(filesPerParentId[parentId], {
context: {
companyId: context.companyId,
@@ -64,6 +69,7 @@ export const useDriveUpload = () => {
},
callback: (file, context) => {
logger.debug('created file: ', file);
uploadedFilesCount++;
if (file) {
create(
{
@@ -87,10 +93,12 @@ export const useDriveUpload = () => {
},
);
}
if (uploadedFilesCount == expectedUploadsCount) {
refresh(parentFolder, true);
}
},
});
}
await refresh(context.parentId, true);
};
const uploadFromUrl = (