Use a persistent notifications model to improve load times of the notifications view

This commit is contained in:
Paul Frazee 2022-11-28 14:19:49 -06:00
parent 1aa1f77049
commit 9051aecdcb
4 changed files with 49 additions and 41 deletions

View file

@ -32,7 +32,7 @@ export const Feed = observer(function Feed({
}
return (
<View style={{flex: 1}}>
{view.isLoading && !view.isRefreshing && !view.hasContent && (
{view.isLoading && !view.isRefreshing && (
<NotificationFeedLoadingPlaceholder />
)}
{view.hasError && (
@ -43,7 +43,7 @@ export const Feed = observer(function Feed({
onPressTryAgain={onPressTryAgain}
/>
)}
{view.hasContent && (
{view.hasLoaded && (
<FlatList
data={view.notifications}
keyExtractor={item => item._reactKey}
@ -53,7 +53,7 @@ export const Feed = observer(function Feed({
onEndReached={onEndReached}
/>
)}
{view.isEmpty && (
{view.hasLoaded && view.isEmpty && (
<EmptyState icon="bell" message="No notifications yet!" />
)}
</View>