mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
fix descending song list id sort
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user