mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
fix descending song list id sort
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import { AxiosHeaders } from 'axios';
|
import { AxiosHeaders } from 'axios';
|
||||||
import isElectron from 'is-electron';
|
import isElectron from 'is-electron';
|
||||||
import orderBy from 'lodash/orderBy';
|
import orderBy from 'lodash/orderBy';
|
||||||
import reverse from 'lodash/reverse';
|
|
||||||
import shuffle from 'lodash/shuffle';
|
import shuffle from 'lodash/shuffle';
|
||||||
import semverCoerce from 'semver/functions/coerce';
|
import semverCoerce from 'semver/functions/coerce';
|
||||||
import semverGte from 'semver/functions/gte';
|
import semverGte from 'semver/functions/gte';
|
||||||
@@ -129,7 +128,7 @@ export const getClientType = (): string => {
|
|||||||
export const SEPARATOR_STRING = ' · ';
|
export const SEPARATOR_STRING = ' · ';
|
||||||
|
|
||||||
export const sortSongList = (songs: Song[], sortBy: SongListSort, sortOrder: SortOrder) => {
|
export const sortSongList = (songs: Song[], sortBy: SongListSort, sortOrder: SortOrder) => {
|
||||||
let results = songs;
|
let results: Song[] = songs;
|
||||||
|
|
||||||
const order = sortOrder === SortOrder.ASC ? 'asc' : 'desc';
|
const order = sortOrder === SortOrder.ASC ? 'asc' : 'desc';
|
||||||
|
|
||||||
@@ -192,8 +191,10 @@ export const sortSongList = (songs: Song[], sortBy: SongListSort, sortOrder: Sor
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SongListSort.ID:
|
case SongListSort.ID:
|
||||||
|
results = [...results];
|
||||||
|
|
||||||
if (order === 'desc') {
|
if (order === 'desc') {
|
||||||
results = reverse(results as any);
|
results.reverse();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user