Browse Source

this.updateDashboardElWidth fixes + timeout

Artur Paikin 8 years ago
parent
commit
4ddc4fe974
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/plugins/Dashboard/index.js

+ 3 - 1
src/plugins/Dashboard/index.js

@@ -161,6 +161,8 @@ module.exports = class DashboardUI extends Plugin {
     document.querySelector('.UppyDashboard-inner').focus()
 
     this.updateDashboardElWidth()
+    // to be sure, sometimes when the function runs, container size is still 0
+    setTimeout(this.updateDashboardElWidth, 300)
   }
 
   initEvents () {
@@ -204,7 +206,7 @@ module.exports = class DashboardUI extends Plugin {
       })
     })
 
-    window.addEventListener('resize', (ev) => this.updateDashboardElWidth())
+    window.addEventListener('resize', this.updateDashboardElWidth)
 
     // bus.on('core:success', (uploadedCount) => {
     //   bus.emit(