Преглед изворни кода

call `removeFile` on each file when doing `cancelAll`

Artur Paikin пре 6 година
родитељ
комит
6463f9e1a4
1 измењених фајлова са 5 додато и 5 уклоњено
  1. 5 5
      packages/@uppy/core/src/index.js

+ 5 - 5
packages/@uppy/core/src/index.js

@@ -505,8 +505,6 @@ class Uppy {
     if (removedFile.preview && isObjectURL(removedFile.preview)) {
     if (removedFile.preview && isObjectURL(removedFile.preview)) {
       URL.revokeObjectURL(removedFile.preview)
       URL.revokeObjectURL(removedFile.preview)
     }
     }
-
-    this.log(`Removed file: ${fileID}`)
   }
   }
 
 
   pauseResume (fileID) {
   pauseResume (fileID) {
@@ -588,16 +586,18 @@ class Uppy {
   cancelAll () {
   cancelAll () {
     this.emit('cancel-all')
     this.emit('cancel-all')
 
 
-    // TODO Or should we just call removeFile on all files?
     const { currentUploads } = this.getState()
     const { currentUploads } = this.getState()
     const uploadIDs = Object.keys(currentUploads)
     const uploadIDs = Object.keys(currentUploads)
-
     uploadIDs.forEach((id) => {
     uploadIDs.forEach((id) => {
       this._removeUpload(id)
       this._removeUpload(id)
     })
     })
 
 
+    const files = Object.keys(this.getState().files)
+    files.forEach((fileID) => {
+      this.removeFile(fileID)
+    })
+
     this.setState({
     this.setState({
-      files: {},
       totalProgress: 0,
       totalProgress: 0,
       error: null
       error: null
     })
     })