fix descending song list id sort

This commit is contained in:
jeffvli
2025-12-08 19:38:19 -08:00
parent 507bf66f47
commit 76b59921f1
+4 -3
View File
@@ -1,7 +1,6 @@
import { AxiosHeaders } from 'axios';
import isElectron from 'is-electron';
import orderBy from 'lodash/orderBy';
import reverse from 'lodash/reverse';
import shuffle from 'lodash/shuffle';
import semverCoerce from 'semver/functions/coerce';
import semverGte from 'semver/functions/gte';
@@ -129,7 +128,7 @@ export const getClientType = (): string => {
export const SEPARATOR_STRING = ' · ';
export const sortSongList = (songs: Song[], sortBy: SongListSort, sortOrder: SortOrder) => {
let results = songs;
let results: Song[] = songs;
const order = sortOrder === SortOrder.ASC ? 'asc' : 'desc';
@@ -192,8 +191,10 @@ export const sortSongList = (songs: Song[], sortBy: SongListSort, sortOrder: Sor
break;
case SongListSort.ID:
results = [...results];
if (order === 'desc') {
results = reverse(results as any);
results.reverse();
}
break;