Skip to content

Commit

Permalink
fix: 'next' button unresponsive when uploading additional documents b…
Browse files Browse the repository at this point in the history
…efore previous batch completes (langgenius#2991)
  • Loading branch information
rickythink authored Mar 28, 2024
1 parent 830495a commit 714722b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions web/app/components/datasets/create/file-uploader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ const FileUploader = ({
}
}

const fileListCopy = fileListRef.current
return upload({
xhr: new XMLHttpRequest(),
data: formData,
Expand All @@ -142,14 +141,14 @@ const FileUploader = ({
file: res,
progress: -1,
}
const index = fileListCopy.findIndex(item => item.fileID === fileItem.fileID)
fileListCopy[index] = completeFile
onFileUpdate(completeFile, 100, fileListCopy)
const index = fileListRef.current.findIndex(item => item.fileID === fileItem.fileID)
fileListRef.current[index] = completeFile
onFileUpdate(completeFile, 100, fileListRef.current)
return Promise.resolve({ ...completeFile })
})
.catch((e) => {
notify({ type: 'error', message: e?.response?.code === 'forbidden' ? e?.response?.message : t('datasetCreation.stepOne.uploader.failed') })
onFileUpdate(fileItem, -2, fileListCopy)
onFileUpdate(fileItem, -2, fileListRef.current)
return Promise.resolve({ ...fileItem })
})
.finally()
Expand Down

0 comments on commit 714722b

Please sign in to comment.