Skip to content

Commit

Permalink
🐛Fixed "folder size isn't displayed after the upload"
Browse files Browse the repository at this point in the history
  • Loading branch information
shepilov authored and ericlinagora committed Jul 23, 2024
1 parent 881eb65 commit 6ce005f
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,21 @@ 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,
parentId: parentId,
},
callback: (file, context) => {
logger.debug('created file: ', file);
uploadedFilesCount++;
if (file) {
create(
{
Expand All @@ -87,10 +93,12 @@ export const useDriveUpload = () => {
},
);
}
if (uploadedFilesCount == expectedUploadsCount) {
refresh(parentFolder, true);
}
},
});
}
await refresh(context.parentId, true);
};

const uploadFromUrl = (
Expand Down

0 comments on commit 6ce005f

Please sign in to comment.