fix(uploads): Animate upload bars, throttle FileUploadStore updates triggered by progress changes

This commit is contained in:
Ben Gotow 2015-07-17 18:28:18 -07:00
parent 5631316360
commit 58dcf3ae22
2 changed files with 10 additions and 1 deletions

View file

@ -61,6 +61,8 @@
display: block;
background: @progress-bar-fill;
border-bottom-left-radius:4px;
transition: width .3s linear;
}
.progress-background {
position: absolute;

View file

@ -80,7 +80,14 @@ FileUploadStore = Reflux.createStore
# state - one of "pending" "started" "progress" "completed" "aborted" "failed"
_onUploadStateChanged: (uploadData) ->
@_fileUploads[uploadData.uploadTaskId] = uploadData
@trigger()
@_fileUploadTrigger ?= _.throttle =>
@trigger()
, 250
# Note: We throttle file upload updates, because they cause a significant refresh
# of the composer and when many uploads are running there can be a ton of state
# changes firing. (To test: drag and drop 20 files onto composer, watch performance.)
@_fileUploadTrigger()
_onAbortUpload: (uploadData) ->
Actions.dequeueMatchingTask