Kaynağa Gözat

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.
Renée Kooi 5 yıl önce
ebeveyn
işleme
d05f37488d
1 değiştirilmiş dosya ile 3 ekleme ve 7 silme
  1. 3 7
      packages/@uppy/core/src/index.js

+ 3 - 7
packages/@uppy/core/src/index.js

@@ -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)