core: use setFileState inside retryUpload (#1759)

Makes it a bit easier to follow. It also logs a warning now when you do
`.retryUpload(SomeNonsenseFileID)` instead of silently adding an invalid
object to the state.
This commit is contained in:
Renée Kooi 2019-07-31 14:46:49 +02:00 committed by GitHub
parent 95a13ff52f
commit d05f37488d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -660,13 +660,9 @@ class Uppy {
}
retryUpload (fileID) {
const updatedFiles = Object.assign({}, this.getState().files)
const updatedFile = Object.assign({}, updatedFiles[fileID],
{ error: null, isPaused: false }
)
updatedFiles[fileID] = updatedFile
this.setState({
files: updatedFiles
this.setFileState(fileID, {
error: null,
isPaused: false
})
this.emit('upload-retry', fileID)