From 5fa3c16d0d374c7c09616b845a9cdf42c826c806 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Mon, 12 Dec 2022 09:56:19 -0600 Subject: [PATCH] Fix duplicate 'end of feed' issue --- src/view/screens/Profile.tsx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx index 1a52ded8..2425579a 100644 --- a/src/view/screens/Profile.tsx +++ b/src/view/screens/Profile.tsx @@ -100,13 +100,15 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => { let items: any[] = [] if (uiState) { if (uiState.isInitialLoading) { - items.push(LOADING_ITEM) + items = items.concat([LOADING_ITEM]) renderItem = () => } else if (uiState.currentView.hasError) { - items.push({ - _reactKey: '__error__', - error: uiState.currentView.error, - }) + items = items.concat([ + { + _reactKey: '__error__', + error: uiState.currentView.error, + }, + ]) renderItem = (item: any) => ( { items = uiState.feed.feed.slice() } if (!uiState.feed.hasMore) { - items.push(END_ITEM) + items = items.concat([END_ITEM]) } renderItem = (item: any) => { if (item === END_ITEM) { @@ -138,7 +140,7 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => { return } } else if (uiState.feed.isEmpty) { - items.push(EMPTY_ITEM) + items = items.concat([EMPTY_ITEM]) if (uiState.profile.isScene) { renderItem = () => ( { ) } } else if (uiState.memberships.isEmpty) { - items.push(EMPTY_ITEM) + items = items.concat([EMPTY_ITEM]) renderItem = () => ( { ) } } else if (uiState.members.isEmpty) { - items.push(EMPTY_ITEM) + items = items.concat([EMPTY_ITEM]) renderItem = () => ( { ) } } else { - items.push(EMPTY_ITEM) + items = items.concat([EMPTY_ITEM]) renderItem = () => TODO } }