[FIX] MusicList, MusicItem, IconButton: Prevent double-add on consecutive likes

Fixes the issue where consecutive likes on a track mistakenly
added it twice to the liked list. Now ensures correct toggling
between like and unlike.
This commit is contained in:
mathysPaul
2024-01-07 01:30:58 +01:00
committed by Clément Le Bihan
parent a103666caf
commit 5ef3885f72
4 changed files with 5 additions and 7 deletions

View File

@@ -43,8 +43,8 @@ const MusicListCC = ({ data, isLoading, refetch }: MusicListCCProps) => {
lastScore: song.lastScore,
bestScore: song.bestScore,
liked: isLiked,
onLike: () => {
mutateAsync({ songId: song.id, like: !isLiked }).then(() => refetch());
onLike: (state: boolean) => {
mutateAsync({ songId: song.id, like: state }).then(() => refetch());
},
onPlay: () => navigation.navigate('Play', { songId: song.id }),
};