From 25bb380976d2caa9dff08f3937e6adfd75630866 Mon Sep 17 00:00:00 2001 From: 6ea86b96 <6ea86b96@gmail.com> Date: Mon, 22 May 2017 19:22:24 +0400 Subject: [PATCH] Display featured content immediately if it's already loaded --- ui/js/page/discover/view.jsx | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/ui/js/page/discover/view.jsx b/ui/js/page/discover/view.jsx index 024f0d913..91cdfafda 100644 --- a/ui/js/page/discover/view.jsx +++ b/ui/js/page/discover/view.jsx @@ -34,24 +34,23 @@ class DiscoverPage extends React.Component{ fetchingFeaturedUris, } = this.props - let content - - if (fetchingFeaturedUris) { - content = <BusyMessage message="Fetching content" /> - } else { - if (typeof featuredUris === "object") { - content = Object.keys(featuredUris).map(category => { - return featuredUris[category].length ? - <FeaturedCategory key={category} category={category} names={featuredUris[category]} /> : - ''; - }) - } else if (featuredUris !== undefined) { - content = <div className="empty">Failed to load landing content.</div> - } - } - return ( - <main>{content}</main> + <main> + { + fetchingFeaturedUris && + <BusyMessage message="Fetching content" /> + } + { + typeof featuredUris === "object" && + Object.keys(featuredUris).map(category => ( + featuredUris[category].length ? <FeaturedCategory key={category} category={category} names={featuredUris[category]} /> : '' + )) + } + { + typeof featuredUris !== undefined && + <div className="empty">Failed to load landing content.</div> + } + </main> ) } }