[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:
committed by
Clément Le Bihan
parent
a103666caf
commit
5ef3885f72
@@ -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 }),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user