diff --git a/packages/frontend/src/components/PaginatedSongList.tsx b/packages/frontend/src/components/PaginatedSongList.tsx index 8b9b143..3100963 100644 --- a/packages/frontend/src/components/PaginatedSongList.tsx +++ b/packages/frontend/src/components/PaginatedSongList.tsx @@ -50,6 +50,8 @@ const SongItem = memo<{ onToggleSelection: (songId: string) => void; showCheckbox: boolean; }>(({ song, isSelected, isHighlighted, onSelect, onToggleSelection, showCheckbox }) => { + // Memoize the formatted duration to prevent recalculation + const formattedDuration = useMemo(() => formatDuration(song.totalTime || ''), [song.totalTime]); const handleClick = useCallback(() => { onSelect(song); }, [onSelect, song]); @@ -89,7 +91,7 @@ const SongItem = memo<{ - {formatDuration(song.totalTime || '')} + {formattedDuration} {song.averageBpm} BPM @@ -213,7 +215,7 @@ export const PaginatedSongList: React.FC = memo(({ showCheckbox={selectedSongs.size > 0 || depth === 0} /> )); - }, [songs, selectedSongs, selectedSongId, handleSongSelect, toggleSelection, depth]); + }, [songs, selectedSongs, selectedSongId, toggleSelection, depth]); // Removed handleSongSelect since it's already memoized // Use total playlist duration if available, otherwise calculate from current songs const totalDuration = useMemo(() => {