From c2f035ae66a55c30edaca4fdf926191ec54ffdb0 Mon Sep 17 00:00:00 2001 From: Kiran Anto Date: Tue, 4 Aug 2020 08:29:25 +0530 Subject: [PATCH] homepageFeed: Add null checks in cases where there's no featured story present (#9528) --- app/javascript/packs/homePageFeed.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/javascript/packs/homePageFeed.jsx b/app/javascript/packs/homePageFeed.jsx index 798bfc8a5..20464e2cb 100644 --- a/app/javascript/packs/homePageFeed.jsx +++ b/app/javascript/packs/homePageFeed.jsx @@ -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 (
+ {featuredStory &&
+ />} {podcastEpisodes.length > 0 && ( )}