From 02f36529323a5bdb092b41c3947dfb193f5cb899 Mon Sep 17 00:00:00 2001 From: lovegaoshi <106490582+lovegaoshi@users.noreply.github.com> Date: Wed, 5 Jun 2024 05:33:03 -0700 Subject: [PATCH] fix: shuffle all --- changelog.txt | 2 +- .../Playlists/PlaylistsHeader/ShuffleAllButton.tsx | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index 14a42d2..5da3d5f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,7 +5,7 @@ 一切因为使用电闹播放器导致您账号被风控封禁的问题,电闹播放器恕不负责。 -4.0.1: +4.0.2: github同步 歌词性能提升 memoryEfficiency diff --git a/src/components/Playlists/PlaylistsHeader/ShuffleAllButton.tsx b/src/components/Playlists/PlaylistsHeader/ShuffleAllButton.tsx index bae1cbf..2dde68b 100644 --- a/src/components/Playlists/PlaylistsHeader/ShuffleAllButton.tsx +++ b/src/components/Playlists/PlaylistsHeader/ShuffleAllButton.tsx @@ -12,10 +12,14 @@ interface Props { } function ShuffleAll({ sx }: Props) { const playlists = useNoxSetting((state) => state.playlists); + const getPlaylist = useNoxSetting((state) => state.getPlaylist); const { loadToSearchListAndPlay } = usePlayback(); - const shuffleAll = () => { - const allSongs = Object.values(playlists).reduce( + const shuffleAll = async () => { + const allPlaylists = await Promise.all( + Object.values(playlists).map((p) => getPlaylist(p.id)), + ); + const allSongs = Object.values(allPlaylists).reduce( (acc, curr) => acc.concat(curr.songList), [] as NoxMedia.Song[], );