diff --git a/src/components/DynamicRecommendations.tsx b/src/components/DynamicRecommendations.tsx index 336f826..309fd67 100644 --- a/src/components/DynamicRecommendations.tsx +++ b/src/components/DynamicRecommendations.tsx @@ -154,12 +154,16 @@ class DynamicRecommendations extends React.Component<{recTargetProp : string}, {
{function(recommendations : GetRecommendationsResponse | {}) { + if (Object.keys(recommendations).length == 0) { + return; + } + let recs = (recommendations as GetRecommendationsResponse)["tracks"]; let recommendedTracksHTML = []; for (let i = 0; i < 6; i++) { - let recommendedSong = 0 ? (recommendations as GetRecommendationsResponse)["tracks"][i].album.images[0].url : ""} - songAlbum={Object.keys(recommendations).length > 0 ? (recommendations as GetRecommendationsResponse)["tracks"][i].album.name : ""} - songName={Object.keys(recommendations).length > 0 ? (recommendations as GetRecommendationsResponse)["tracks"][i].name : ""} - songArtists={Object.keys(recommendations).length > 0 ? (recommendations as GetRecommendationsResponse)["tracks"][i].artists.map((artist) => artist.name):[]} + let recommendedSong = artist.name)} key={i}> ; recommendedTracksHTML.push(recommendedSong);