From bffc27e8d0851f4697df658e2c37d0a7040d0895 Mon Sep 17 00:00:00 2001 From: infinite-persistence <64950861+infinite-persistence@users.noreply.github.com> Date: Wed, 16 Mar 2022 05:49:44 -0700 Subject: [PATCH] Just always show homepage segment titles.. (#1116) ## Issue - "Following" was showing up in place of "Featured" - "Following" doesn't appear until livestreams are fetched, causing shifts. When "Upcoming Livestreams" was implemented, it was trying to retain the original behavior of not showing "Following" title if that was the first in the list. Not only is it a chicken-and-egg problem, but it causes extra renders due to the need to check if the other guys was rendered. With FYP, there are now more combinations to handle. ## Change Just show the title... --- ui/component/recommendedPersonal/view.jsx | 4 +++- ui/page/home/view.jsx | 24 +++++++++-------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/ui/component/recommendedPersonal/view.jsx b/ui/component/recommendedPersonal/view.jsx index 18e96de2d..af62c91b6 100644 --- a/ui/component/recommendedPersonal/view.jsx +++ b/ui/component/recommendedPersonal/view.jsx @@ -72,7 +72,9 @@ export default function RecommendedPersonal(props: Props) { React.useEffect(() => { // -- Update parent's callback request - onLoad(count > 0); + if (typeof onLoad === 'function') { + onLoad(count > 0); + } }, [count, onLoad]); React.useEffect(() => { diff --git a/ui/page/home/view.jsx b/ui/page/home/view.jsx index 280f98e77..88ebc5fd3 100644 --- a/ui/page/home/view.jsx +++ b/ui/page/home/view.jsx @@ -2,7 +2,7 @@ import * as ICONS from 'constants/icons'; import * as PAGES from 'constants/pages'; import { SITE_NAME, SIMPLE_SITE, ENABLE_NO_SOURCE_CLAIMS } from 'config'; -import React, { useState } from 'react'; +import React from 'react'; import Page from 'component/page'; import Button from 'component/button'; import ClaimTilesDiscover from 'component/claimTilesDiscover'; @@ -22,6 +22,10 @@ import Ads from 'web/component/ads'; import Meme from 'web/component/meme'; // @endif +function resolveTitleOverride(title: string) { + return title === 'Recent From Following' ? 'Following' : title; +} + type Props = { authenticated: boolean, followedTags: Array, @@ -119,19 +123,18 @@ function HomePage(props: Props) { 'show-ribbon': index === 0, })} > - {/* category header */} - {index !== 0 && title && typeof title === 'string' && ( - + {title && typeof title === 'string' && ( + )} {index === 0 && <>{claimTiles}} + {index !== 0 && ( {claimTiles} )} - {/* view more button */} {(route || link) && (