Sfoglia il codice sorgente

Add comments around empty `setState` calls (#2931)

Antoine du Hamel 3 anni fa
parent
commit
8b1b794b73

+ 1 - 0
packages/@uppy/core/src/index.js

@@ -326,6 +326,7 @@ class Uppy {
       })
     }
 
+    // Note: this is not the preact `setState`, it's an internal function that has the same name.
     this.setState() // so that UI re-renders with new options
   }
 

+ 2 - 1
packages/@uppy/store-redux/src/index.js

@@ -23,7 +23,8 @@ class ReduxStore {
     this._id = opts.id || cuid()
     this._selector = opts.selector || defaultSelector(this._id)
 
-    // Initialise the `uppy[id]` state key.
+    // Calling `setState` to dispatch an action to the Redux store.
+    // The intent is to make sure that the reducer has run once.
     this.setState({})
   }