Skip to content

fix(upload): reload the file list once per upload queue - #168

Open
czachor wants to merge 1 commit into
artgris:masterfrom
czachor:fix/upload-single-reload
Open

czachor wants to merge 1 commit into
artgris:masterfrom
czachor:fix/upload-single-reload

Conversation

@czachor

@czachor czachor commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

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 fileuploaddone handler in manager.js runs 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: fileuploaddone only shows the per-file notifications, as before, and marks that a reload is needed. The reload (moved unchanged into a reloadList() function) runs in fileuploadstop, 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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant