Skip to content

Commit

Permalink
Add 'as loaded' sort ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
antonnyst committed Nov 18, 2024
1 parent 62c4e06 commit 9e32163
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/js/components/SearchResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ const SearchResults = ({
const encodedTerm = encodeURIComponent(term);
let results = [...rawResults];

results = sortItems(
results,
(type === 'tracks' && sortField === 'followers' ? 'popularity' : sortField),
sortReverse,
);
if (sortField) {
results = sortItems(
results,
(type === 'tracks' && sortField === 'followers' ? 'popularity' : sortField),
sortReverse,
);
}

const resultsCount = results.length;
if (all && type !== 'tracks' && results.length > 5) {
Expand Down
1 change: 1 addition & 0 deletions src/js/views/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const Search = () => {
}

const sortOptions = [
{ value: null, label: i18n('fields.filters.as_loaded') },
{ value: 'name', label: i18n('common.name') },
{ value: 'uri', label: i18n('fields.filters.source') },
{ value: 'followers', label: i18n('common.popularity') },
Expand Down

0 comments on commit 9e32163

Please sign in to comment.