From 7ecc2be207d4fa176c5fc5c8754cfcdfabbad308 Mon Sep 17 00:00:00 2001 From: Philipp Daun Date: Wed, 11 Dec 2024 22:19:20 +0100 Subject: [PATCH] [5.x] Fix asset upload concurrency on folder upload (#11225) --- resources/js/components/assets/Uploader.vue | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/resources/js/components/assets/Uploader.vue b/resources/js/components/assets/Uploader.vue index 816c97f956..6e0904d4e6 100644 --- a/resources/js/components/assets/Uploader.vue +++ b/resources/js/components/assets/Uploader.vue @@ -68,6 +68,15 @@ export default { }, + computed: { + + activeUploads() { + return this.uploads.filter(u => u.instance.state === 'started'); + } + + }, + + methods: { browse() { @@ -230,6 +239,9 @@ export default { }, processUploadQueue() { + // If we're already uploading, don't start another + if (this.activeUploads.length) return; + // Make sure we're not grabbing a running or failed upload const upload = this.uploads.find(u => u.instance.state === 'new' && !u.errorMessage); if (!upload) return; @@ -248,6 +260,8 @@ export default { response.status === 200 ? this.handleUploadSuccess(id, json) : this.handleUploadError(id, response.status, json); + + this.processUploadQueue(); }); },