mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-28 11:32:46 +03:00
fix(Upload): fix the wrong number for files being uploaded by skipping the submitted file if it's currently uploading
This commit is contained in:
parent
7aff27dff1
commit
f0976aed8f
@ -133,11 +133,12 @@ export function createUploadProvider({
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const fileKey = getFileKey(files[i]);
|
||||
const doesQueueIncludeFile = getUploadQueue().some(
|
||||
({ file }) => getFileKey(files[i]) === getFileKey(file)
|
||||
({ file }) => getFileKey(file) === fileKey
|
||||
);
|
||||
const isUploaded = fileKey in UploadStore.uploadedFiles;
|
||||
const isUploading = UploadAbort.currentUploadingFile === fileKey;
|
||||
// NOTE(amine): skip the file if already uploaded or is in queue
|
||||
if (doesQueueIncludeFile || isUploaded) continue;
|
||||
if (doesQueueIncludeFile || isUploaded || isUploading) continue;
|
||||
|
||||
// NOTE(amine): if the added file has failed before, remove it from failedFilesCache
|
||||
if (fileKey in UploadStore.failedFilesCache) removeFileFromCache({ fileKey });
|
||||
@ -194,8 +195,9 @@ export function createUploadProvider({
|
||||
({ file }) => getFileKey(linkAsFile) === getFileKey(file)
|
||||
);
|
||||
const isUploaded = fileKey in UploadStore.uploadedFiles;
|
||||
const isUploading = UploadAbort.currentUploadingFile === fileKey;
|
||||
// NOTE(amine): skip the file if already uploaded or is in queue
|
||||
if (doesQueueIncludeFile || isUploaded) return;
|
||||
if (doesQueueIncludeFile || isUploaded || isUploading) return;
|
||||
|
||||
// NOTE(amine): if the added file has failed before, remove it from failedFilesCache
|
||||
if (fileKey in UploadStore.failedFilesCache) removeFileFromCache({ fileKey });
|
||||
|
Loading…
Reference in New Issue
Block a user