Browse Source

Check for existing upload (#1367)

* Check for currentUpload

* Update comment
Andrew Shini 5 years ago
parent
commit
01da52ae22
1 changed files with 9 additions and 4 deletions
  1. 9 4
      packages/@uppy/core/src/index.js

+ 9 - 4
packages/@uppy/core/src/index.js

@@ -1181,18 +1181,23 @@ class Uppy {
 
       lastStep = lastStep.then(() => {
         const { currentUploads } = this.getState()
-        const currentUpload = Object.assign({}, currentUploads[uploadID], {
+        const currentUpload = currentUploads[uploadID]
+        if (!currentUpload) {
+          return
+        }
+
+        const updatedUpload = Object.assign({}, currentUpload, {
           step: step
         })
         this.setState({
           currentUploads: Object.assign({}, currentUploads, {
-            [uploadID]: currentUpload
+            [uploadID]: updatedUpload
           })
         })
 
-        // TODO give this the `currentUpload` object as its only parameter maybe?
+        // TODO give this the `updatedUpload` object as its only parameter maybe?
         // Otherwise when more metadata may be added to the upload this would keep getting more parameters
-        return fn(currentUpload.fileIDs, uploadID)
+        return fn(updatedUpload.fileIDs, uploadID)
       }).then((result) => {
         return null
       })