Fix like button in right sidebar passing Song object instead of ID

The onToggleLike handler expected a string songId but RightSidebar
was passing the entire Song object, causing a FOREIGN KEY constraint
error when SQLite received '[object Object]' as the song_id.

Fixes #22
This commit is contained in:
fspecii
2026-02-05 22:59:41 +02:00
parent 23ff094aad
commit 2f2b1e2f92
+2 -2
View File
@@ -16,7 +16,7 @@ interface RightSidebarProps {
onNavigateToProfile?: (username: string) => void; onNavigateToProfile?: (username: string) => void;
onNavigateToSong?: (songId: string) => void; onNavigateToSong?: (songId: string) => void;
isLiked?: boolean; isLiked?: boolean;
onToggleLike?: (song: Song) => void; onToggleLike?: (songId: string) => void;
onDelete?: (song: Song) => void; onDelete?: (song: Song) => void;
onAddToPlaylist?: (song: Song) => void; onAddToPlaylist?: (song: Song) => void;
onPlay?: (song: Song) => void; onPlay?: (song: Song) => void;
@@ -335,7 +335,7 @@ export const RightSidebar: React.FC<RightSidebarProps> = ({ song, onClose, onOpe
icon={<Heart size={22} fill={isLiked ? 'currentColor' : 'none'} />} icon={<Heart size={22} fill={isLiked ? 'currentColor' : 'none'} />}
label={String(song.likeCount || 0)} label={String(song.likeCount || 0)}
active={isLiked} active={isLiked}
onClick={() => onToggleLike?.(song)} onClick={() => onToggleLike?.(song.id)}
/> />
<ActionButton icon={<Share2 size={22} />} onClick={() => setShareModalOpen(true)} /> <ActionButton icon={<Share2 size={22} />} onClick={() => setShareModalOpen(true)} />
</div> </div>