From 7c6f62023a1f987fa313223d927c90b7012cd28e Mon Sep 17 00:00:00 2001 From: jeffvli Date: Sun, 21 May 2023 07:31:18 -0700 Subject: [PATCH] Fix song null check on queue add --- .../features/player/hooks/use-handle-playqueue-add.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/renderer/features/player/hooks/use-handle-playqueue-add.ts b/src/renderer/features/player/hooks/use-handle-playqueue-add.ts index f1954abd..a4bf04d4 100644 --- a/src/renderer/features/player/hooks/use-handle-playqueue-add.ts +++ b/src/renderer/features/player/hooks/use-handle-playqueue-add.ts @@ -118,10 +118,11 @@ export const useHandlePlayQueueAdd = () => { songs = songList?.items?.map((song: Song) => ({ ...song, uniqueId: nanoid() })) || null; } else if (byData) { - songs = byData.map((song) => ({ ...song, uniqueId: nanoid() })); + songs = byData.map((song) => ({ ...song, uniqueId: nanoid() })) || null; } - if (!songs) return toast.warn({ message: 'No songs found' }); + if (!songs || songs?.length === 0) + return toast.warn({ message: 'The query returned no results', title: 'No tracks added' }); if (initialIndex) { initialSongIndex = initialIndex;