From b1be4cc6b1561d1f79590197cccd549d9d1b2153 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Sat, 20 Feb 2021 13:23:06 -0500 Subject: sp preview fix --- src/screens/suggestedPeople/SuggestedPeopleScreen.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/screens/suggestedPeople/SuggestedPeopleScreen.tsx b/src/screens/suggestedPeople/SuggestedPeopleScreen.tsx index cdcc640f..66ad8ee9 100644 --- a/src/screens/suggestedPeople/SuggestedPeopleScreen.tsx +++ b/src/screens/suggestedPeople/SuggestedPeopleScreen.tsx @@ -62,9 +62,8 @@ const SuggestedPeopleScreen: React.FC = () => { loadMore(false); }, [page]); - const loadMore = async (resetData: boolean) => { + useFocusEffect(() => { const appendSelf = async () => { - console.log('Appending own profile to the top'); AsyncStorage.getItem('suggested_people_url').then((image) => { console.log('image path: ', image); const self = { @@ -77,17 +76,18 @@ const SuggestedPeopleScreen: React.FC = () => { social_links: [], suggested_people_url: image ? image : '', }; - console.log('self: ', self); people.unshift(self); setPeople(people); }); }; - - console.log('suggested_people_linked', suggested_people_linked); - console.log('Append profile only if suggested people is less than 2'); if (suggested_people_linked < 2) { - await appendSelf(); + if (people.length > 1 && people[0].user.id !== loggedInUserId) { + appendSelf(); + } } + }); + + const loadMore = async (resetData: boolean) => { const loadNextPage = async () => await getSuggestedPeople(SP_PAGE_SIZE, page * SP_PAGE_SIZE); -- cgit v1.2.3-70-g09d2