Fix upload UI stuck on "Processing files..."
The `uploading` flag was only cleared by `x-init="uploading = false"` on the file list, which Alpine runs when the element is initialized. Adding a second batch of files to the same share only patches that existing element, so the flag stayed true forever: the spinner never went away, the drop zone stayed disabled and the submit button stayed disabled, making the share impossible to create. `updatedFiles()` now dispatches `files-processed`, which runs for every batch, and the form resets its upload state on that event instead. Also fixes two adjacent bugs in the drag & drop path: `uploadMultiple()` was called without callbacks so dropped files showed no progress at all, and `relativePaths` was replaced instead of appended, shifting every earlier file's path onto the wrong file on a second drop. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
084cefe023
commit
d2e8a135c5
@@ -65,8 +65,17 @@ class FileUploader extends Component
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a freshly uploaded batch of files.
|
||||
*
|
||||
* Dispatches `files-processed` so the front end can drop its "uploading" state.
|
||||
* This runs for every batch, including additional files added to an existing
|
||||
* selection, which a one-off `x-init` on the file list cannot cover.
|
||||
*/
|
||||
public function updatedFiles(): void
|
||||
{
|
||||
$this->dispatch('files-processed')->self();
|
||||
|
||||
$maxFileSize = (int) Setting::get('max_file_size', 100 * 1024 * 1024);
|
||||
$maxFileSizeMb = $maxFileSize / (1024 * 1024);
|
||||
$maxFilesPerShare = (int) Setting::get('max_files_per_share', 50);
|
||||
|
||||
Reference in New Issue
Block a user