From f667e9ea8fb6185ff72605b25bd4faf09e5315e5 Mon Sep 17 00:00:00 2001 From: Sanjay Bhangar Date: Fri, 7 Dec 2018 19:33:42 +0200 Subject: [PATCH] really fix issues with random topic on first load --- src/containers/Home.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/containers/Home.js b/src/containers/Home.js index fe607e7..b426128 100644 --- a/src/containers/Home.js +++ b/src/containers/Home.js @@ -18,10 +18,11 @@ class Home extends React.Component { } componentWillReceiveProps(nextProps) { + console.log('nextProps', nextProps); // This is slightly awkward - we need to check that we have all topics, // But don't have a random topic yet (or at not already loading a random topic) - if (this.props.allTopics && !(this.props.loadingRandomTopic || nextProps.loadingRandomTopic) && !this.props.randomTopic) { - this.props.getRandomTopicVideos(this.props.allTopics); + if ((this.props.allTopics || nextProps.allTopics) && !this.props.loadingRandomTopic && !nextProps.loadingRandomTopic && !this.props.randomTopic) { + this.props.getRandomTopicVideos(nextProps.allTopics); } }