From a3a7ec0873572c430db1e01d7ff9d924300ee674 Mon Sep 17 00:00:00 2001 From: Eliot Berriot <contact@eliotberriot.com> Date: Thu, 7 Mar 2019 10:35:33 +0100 Subject: [PATCH] Fix #716: constant and unpredictable reordering during file upload --- changes/changelog.d/716.bugfix | 1 + front/src/components/library/FileUpload.vue | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 changes/changelog.d/716.bugfix diff --git a/changes/changelog.d/716.bugfix b/changes/changelog.d/716.bugfix new file mode 100644 index 00000000..1b9b182c --- /dev/null +++ b/changes/changelog.d/716.bugfix @@ -0,0 +1 @@ +Fixed constant and unpredictable reordering during file upload (#716) diff --git a/front/src/components/library/FileUpload.vue b/front/src/components/library/FileUpload.vue index b7c164eb..06fbdbad 100644 --- a/front/src/components/library/FileUpload.vue +++ b/front/src/components/library/FileUpload.vue @@ -279,15 +279,18 @@ export default { }, sortedFiles() { // return errored files on top - return this.files.sort(f => { + + return _.sortBy(this.files.map(f => { + let statusIndex = 0 if (f.errored) { - return -5; + statusIndex = -1 } if (f.success) { - return 5; + statusIndex = 1 } - return 0; - }); + f.statusIndex = statusIndex + return f + }), ['statusIndex', 'name']) } }, watch: { -- GitLab