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:
@@ -16,7 +16,7 @@ interface RightSidebarProps {
|
||||
onNavigateToProfile?: (username: string) => void;
|
||||
onNavigateToSong?: (songId: string) => void;
|
||||
isLiked?: boolean;
|
||||
onToggleLike?: (song: Song) => void;
|
||||
onToggleLike?: (songId: string) => void;
|
||||
onDelete?: (song: Song) => void;
|
||||
onAddToPlaylist?: (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'} />}
|
||||
label={String(song.likeCount || 0)}
|
||||
active={isLiked}
|
||||
onClick={() => onToggleLike?.(song)}
|
||||
onClick={() => onToggleLike?.(song.id)}
|
||||
/>
|
||||
<ActionButton icon={<Share2 size={22} />} onClick={() => setShareModalOpen(true)} />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user