From d70ade2e653ee93aca09d62ab7822b8d0f6dc2b5 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 26 Jan 2021 18:23:44 -0500 Subject: fixed no internet app crash --- src/components/profile/FriendsCount.tsx | 6 +++--- src/components/search/Explore.tsx | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/components/profile/FriendsCount.tsx b/src/components/profile/FriendsCount.tsx index 9647710e..851dbc3b 100644 --- a/src/components/profile/FriendsCount.tsx +++ b/src/components/profile/FriendsCount.tsx @@ -17,10 +17,10 @@ const FriendsCount: React.FC = ({ userXId, screenType, }) => { - const count = (userXId + const {friends} = userXId ? useSelector((state: RootState) => state.userX[screenType][userXId]) - : useSelector((state: RootState) => state.friends) - )?.friends.length; + : useSelector((state: RootState) => state.friends); + const count = friends ? friends.length : 0; const displayedCount: string = count < 5e3 diff --git a/src/components/search/Explore.tsx b/src/components/search/Explore.tsx index 4a71249b..2a3bc749 100644 --- a/src/components/search/Explore.tsx +++ b/src/components/search/Explore.tsx @@ -12,9 +12,10 @@ const Explore: React.FC = () => { return ( Search Profiles - {EXPLORE_SECTION_TITLES.map((title: ExploreSectionType) => ( - - ))} + {explores && + EXPLORE_SECTION_TITLES.map((title: ExploreSectionType) => ( + + ))} ); }; -- cgit v1.2.3-70-g09d2