diff --git a/src/shared/api/utils.ts b/src/shared/api/utils.ts index 10998456d..fada28d09 100644 --- a/src/shared/api/utils.ts +++ b/src/shared/api/utils.ts @@ -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;