Repository navigation
Conversation
fileuploaddone fires once per file, and each call reloaded the whole list (and tree) via AJAX, so uploading N files rescanned the directory N times. The reload now runs in fileuploadstop, which blueimp fires once when the whole queue is finished, and only if at least one file was uploaded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #75
Context
Uploading several files at once into a large directory is slow, and the list flickers while it is rebuilt again and again. The client reloads the whole file list once per uploaded file.
Why a separate PR
#75 has several independent causes, and each is fixed in its own small PR so it can be reviewed, merged or reverted on its own: #166 reduces server work when building the listing, #167 lets the browser cache previews, and this PR changes only the client-side upload flow (
manager.js, no PHP). It does not depend on the other PRs, and they can be merged in any order.Change
Cause: the
fileuploaddonehandler inmanager.jsruns once per file (blueimp uploads each file in its own request). Every call sent an AJAX request for the whole list (and the tree, when enabled) and replaced the DOM. Uploading N files rescanned the directory and re-rendered the list N times.Change:
fileuploaddoneonly shows the per-file notifications, as before, and marks that a reload is needed. The reload (moved unchanged into areloadList()function) runs infileuploadstop, which blueimp fires once, when all uploads of the queue have finished (jquery.fileupload.js,_active === 0). If no file was uploaded successfully, the list is not reloaded, as before.Backward compatibility
No template, configuration or server changes. Success and error notifications are unchanged.
Tests
There is no JavaScript test setup in the bundle, and no PHP code changes.
Merges cleanly with #166 and #167.