Browse Source

core: Move progress recalculation after restore into core

Renée Kooi 7 years ago
parent
commit
a5f990556b
2 changed files with 5 additions and 3 deletions
  1. 5 0
      src/core/Core.js
  2. 0 3
      src/plugins/GoldenRetriever/index.js

+ 5 - 0
src/core/Core.js

@@ -719,6 +719,11 @@ class Uppy {
       this.setState({ files: files })
     })
 
+    this.on('restored', () => {
+      // Files may have changed--ensure progress is still accurate.
+      this._calculateTotalProgress()
+    })
+
     // show informer if offline
     if (typeof window !== 'undefined') {
       window.addEventListener('online', () => this.updateOnlineStatus())

+ 0 - 3
src/plugins/GoldenRetriever/index.js

@@ -172,9 +172,6 @@ module.exports = class GoldenRetriever extends Plugin {
     this.uppy.setState({
       files: updatedFiles
     })
-    // Files have changed--make sure the progress is accurate.
-    // TODO make uppy detect that this is necessary somehow?
-    this.uppy._calculateTotalProgress()
 
     this.uppy.emit('restored', this.savedPluginData)