New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable13] Fix progress bar hidden before the upload ends #9124

Merged
merged 1 commit into from Apr 9, 2018

Conversation

Projects
None yet
3 participants
@danxuliu
Member

danxuliu commented Apr 9, 2018

Backport of #9085

Fix progress bar hidden before the upload ends
The jQuery File Upload plugin triggers the "stop" event once there are
no more files being uploaded (even if some of them were added when
another upload was already in progress). Therefore, the progress bar
should be hidden in the "fileuploadstop" callback.

In some cases the "stop" event is not triggered and thus the progress
bar is not hidden once no more files are being uploaded. This is caused
by a race condition and it will be fixed in another commit; except in
buggy cases like that one (that need to be fixed anyway) it is safe to
hide the progress bar in the "fileuploadstop" callback.

In any case, note that the callbacks in "fileuploaddone" may be called
after the "stop" event was triggered and handled when using chunked
uploads. In that case once all the chunks are uploaded the assembled
file is moved to its final destination, so its promise could be resolved
after the "stop" event was triggered. Therefore a different approach
would be needed to keep the progress bar visible until the chunked
upload is truly finished, but for the time being the current one is good
enough.

Before this commit the progress bar was being hidden when the first
upload finished, either successfully or with an error, no matter if
there were other files being uploaded too.

The progress bar was being explicitly hidden also when the upload was
cancelled. When an upload is cancelled all the single uploads are
aborted, which triggers a "fail" event for each of them. However, the
"stop" event is always triggered when no more files are being uploaded,
so it is triggered too once all the single uploads were aborted. As all
the single uploads are immediately aborted in a loop when the general
upload is cancelled it makes no difference to hide the progress bar when
the first single upload is aborted or when all the single uploads were
aborted, so the progress bar is no longer explicitly hidden in the
former case.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@skjnldsv

Yes please

@codecov

This comment has been minimized.

codecov bot commented Apr 9, 2018

Codecov Report

Merging #9124 into stable13 will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             stable13    #9124   +/-   ##
===========================================
  Coverage       51.34%   51.34%           
  Complexity      25039    25039           
===========================================
  Files            1609     1609           
  Lines           95317    95317           
  Branches         1376     1376           
===========================================
  Hits            48936    48936           
  Misses          46381    46381

@skjnldsv skjnldsv merged commit 3f19eb0 into stable13 Apr 9, 2018

4 checks passed

codecov/patch Coverage not affected when comparing 2b0b717...9e9e053
Details
codecov/project 51.34% remains the same compared to 2b0b717
Details
continuous-integration/drone/pr the build was successful
Details
continuous-integration/drone/push the build was successful
Details

@skjnldsv skjnldsv deleted the stable13-9085-fix-progress-bar-hidden-before-the-upload-ends branch Apr 9, 2018

@skjnldsv skjnldsv added 4. to release and removed 3. to review labels Apr 9, 2018

@MorrisJobke MorrisJobke referenced this pull request Apr 18, 2018

Merged

13.0.2 RC 1 #9228

8 of 11 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment