homepageFeed: Add null checks in cases where there's no featured story present (#9528)

This commit is contained in:
Kiran Anto 2020-08-04 08:29:25 +05:30 committed by GitHub
parent 48d9c28adb
commit c2f035ae66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,21 +82,23 @@ export const renderFeed = (timeFrame) => {
const [featuredStory, ...subStories] = feedItems;
const feedStyle = JSON.parse(document.body.dataset.user).feed_style;
sendFeaturedArticleAnalytics(featuredStory.id);
if(featuredStory) {
sendFeaturedArticleAnalytics(featuredStory.id);
}
// 1. Show the featured story first
// 2. Podcast episodes out today
// 3. Rest of the stories for the feed
return (
<div>
{featuredStory &&
<Article
{...commonProps}
article={featuredStory}
isFeatured
feedStyle={feedStyle}
isBookmarked={bookmarkedFeedItems.has(featuredStory.id)}
/>
/>}
{podcastEpisodes.length > 0 && (
<PodcastEpisodes episodes={podcastEpisodes} />
)}