mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 03:32:23 +08:00
fix: 'next' button unresponsive when uploading additional documents before previous batch completes (#2991)
This commit is contained in:
parent
830495a607
commit
714722bb2d
|
@ -130,7 +130,6 @@ const FileUploader = ({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileListCopy = fileListRef.current
|
|
||||||
return upload({
|
return upload({
|
||||||
xhr: new XMLHttpRequest(),
|
xhr: new XMLHttpRequest(),
|
||||||
data: formData,
|
data: formData,
|
||||||
|
@ -142,14 +141,14 @@ const FileUploader = ({
|
||||||
file: res,
|
file: res,
|
||||||
progress: -1,
|
progress: -1,
|
||||||
}
|
}
|
||||||
const index = fileListCopy.findIndex(item => item.fileID === fileItem.fileID)
|
const index = fileListRef.current.findIndex(item => item.fileID === fileItem.fileID)
|
||||||
fileListCopy[index] = completeFile
|
fileListRef.current[index] = completeFile
|
||||||
onFileUpdate(completeFile, 100, fileListCopy)
|
onFileUpdate(completeFile, 100, fileListRef.current)
|
||||||
return Promise.resolve({ ...completeFile })
|
return Promise.resolve({ ...completeFile })
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
notify({ type: 'error', message: e?.response?.code === 'forbidden' ? e?.response?.message : t('datasetCreation.stepOne.uploader.failed') })
|
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 })
|
return Promise.resolve({ ...fileItem })
|
||||||
})
|
})
|
||||||
.finally()
|
.finally()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user