Bladeren bron

core: Move progress recalculation after restore into core

Renée Kooi 7 jaren geleden
bovenliggende
commit
a5f990556b
2 gewijzigde bestanden met toevoegingen van 5 en 3 verwijderingen
  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.setState({ files: files })
     })
     })
 
 
+    this.on('restored', () => {
+      // Files may have changed--ensure progress is still accurate.
+      this._calculateTotalProgress()
+    })
+
     // show informer if offline
     // show informer if offline
     if (typeof window !== 'undefined') {
     if (typeof window !== 'undefined') {
       window.addEventListener('online', () => this.updateOnlineStatus())
       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({
     this.uppy.setState({
       files: updatedFiles
       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)
     this.uppy.emit('restored', this.savedPluginData)