diff --git a/packages/file-handling/src/fileupload.js b/packages/file-handling/src/fileupload.js index aee6ddc8c702d14255dc77face459a1bb1f1f13d..14e72174d00d07d9fe7e13f2425eec54afb00de8 100644 --- a/packages/file-handling/src/fileupload.js +++ b/packages/file-handling/src/fileupload.js @@ -45,6 +45,7 @@ export class FileUpload extends ScopedElementsMixin(VPULitElement) { this.queuedFiles = []; this.queuedFilesCount = 0; this.disabled = false; + this._queueKey = 0; } static get scopedElements() { @@ -245,9 +246,10 @@ export class FileUpload extends ScopedElementsMixin(VPULitElement) { * @returns {Promise<number>} key of the queued item */ async queueFile(file) { - const key = Math.floor(Math.random() * 1000000); + this._queueKey++; + const key = this._queueKey; this.queuedFiles[key] = file; - this.queuedFilesCount++; + this.updateQueuedFilesCount(); const data = {"file": file}; const event = new CustomEvent("vpu-fileupload-file-queued", { "detail": data, bubbles: true, composed: true });