Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix resetting root on re-upload #846

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -308,7 +315,7 @@ class FileUploadService {
): Promise<PendingFileType[]> {
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) {
Expand Down