Skip to content

Commit aa85722

Browse files
committed
Fix: Sort in browse & remote views
This commit addresses an issue with sorting functionality in the "browse" and "remote" views within the application. The previous implementation of the `sortBy` function contained a nested function, which completely broke the sort functionality. This change also simplifies the `sortBy` function by making the sorting logic more straightforward and easier to understand. This improved clarity and maintainability will benefit developers working on the codebase.
1 parent d7c7c66 commit aa85722

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

views/js/search.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -320,19 +320,17 @@ function openSearch() {
320320
*/
321321
function sortBy(key, asc) {
322322
return (a, b) => {
323-
return (a, b) => {
324-
var valA = $(a).data(key);
325-
var valB = $(b).data(key);
326-
if (valA < valB) {
327-
return asc ? -1 : 1;
328-
}
329-
330-
if (valA > valB) {
331-
return asc ? 1 : -1;
332-
}
333-
334-
return 0;
335-
};
323+
var valA = $(a).data(key);
324+
var valB = $(b).data(key);
325+
if (valA < valB) {
326+
return asc ? -1 : 1;
327+
}
328+
329+
if (valA > valB) {
330+
return asc ? 1 : -1;
331+
}
332+
333+
return 0;
336334
};
337335
}
338336

0 commit comments

Comments
 (0)