diff --git a/html/js/melpa.js b/html/js/melpa.js index ee3ee0aa..eeee6909 100644 --- a/html/js/melpa.js +++ b/html/js/melpa.js @@ -92,8 +92,12 @@ } var sortKey = sortBy + "-" + sortAscending; if (packages.sortKey === sortKey) return packages; - var matched = _.sortBy(packages, function(p) { return p[sortBy](); }); - packages = savedSearches[t] = sortAscending ? matched : matched.reverse(); + if (packages.sortKey === sortBy + "-" + !sortAscending) { + packages = packages.reverse(); + } else { + var matched = _.sortBy(packages, function(p) { return p[sortBy](); }); + packages = savedSearches[t] = sortAscending ? matched : matched.reverse(); + } packages.sortKey = sortKey; return packages; };