mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-03 06:32:06 +08:00
fix(uploads): Animate upload bars, throttle FileUploadStore updates triggered by progress changes
This commit is contained in:
parent
5631316360
commit
58dcf3ae22
2 changed files with 10 additions and 1 deletions
|
@ -61,6 +61,8 @@
|
|||
display: block;
|
||||
background: @progress-bar-fill;
|
||||
border-bottom-left-radius:4px;
|
||||
transition: width .3s linear;
|
||||
|
||||
}
|
||||
.progress-background {
|
||||
position: absolute;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue