From 9af34a08f8a8557fd164383826d284548829b1df Mon Sep 17 00:00:00 2001 From: Bobby Date: Sat, 24 Sep 2022 08:21:01 +0700 Subject: [PATCH] fix: non-sort filter keys getting removed --- src/js/dashboard.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/dashboard.js b/src/js/dashboard.js index 0555e8d..3d124a2 100644 --- a/src/js/dashboard.js +++ b/src/js/dashboard.js @@ -1250,6 +1250,9 @@ page.uniquifyUploadsFilters = string => { const uniquified = filtersArray .filter((v, i, a) => { + // Filter out invalid values + if (!v) return false + const match = v.match(/^(sort|orderby):(\w+)(:.*)?$/i) // Uniquify sort/orderby filters by their keys if (match && match[2]) { @@ -1259,7 +1262,7 @@ page.uniquifyUploadsFilters = string => { return lastIndex === i } // Uniquify other filters by exact string matches - return i !== a.lastIndexOf(v) + return i === a.lastIndexOf(v) }) return uniquified