Bluesky app fork with some witchin' additions 💫 witchsky.app
bluesky fork client

Notifs refresh improvement (#1941)

* Show loading state in notifications

* Fix invalidation of notifs

* Move spinner below header

* Fix: dont show spinner on initial load

authored by

Paul Frazee and committed by
GitHub
c03c7440 6f57192b

+20 -2
+17 -1
src/view/com/notifications/Feed.tsx
··· 39 39 const { 40 40 data, 41 41 dataUpdatedAt, 42 + isLoading, 42 43 isFetching, 43 44 isFetched, 44 45 isError, ··· 139 140 [onPressRetryLoadMore, dataUpdatedAt, moderationOpts], 140 141 ) 141 142 143 + const showHeaderSpinner = !isPTRing && isFetching && !isLoading 144 + const FeedHeader = React.useCallback( 145 + () => ( 146 + <View> 147 + {ListHeaderComponent ? <ListHeaderComponent /> : null} 148 + {showHeaderSpinner ? ( 149 + <View style={{padding: 10}}> 150 + <ActivityIndicator /> 151 + </View> 152 + ) : null} 153 + </View> 154 + ), 155 + [ListHeaderComponent, showHeaderSpinner], 156 + ) 157 + 142 158 const FeedFooter = React.useCallback( 143 159 () => 144 160 isFetchingNextPage ? ( ··· 168 184 data={items} 169 185 keyExtractor={item => item._reactKey} 170 186 renderItem={renderItem} 171 - ListHeaderComponent={ListHeaderComponent} 187 + ListHeaderComponent={FeedHeader} 172 188 ListFooterComponent={FeedFooter} 173 189 refreshControl={ 174 190 <RefreshControl
+3 -1
src/view/screens/Notifications.tsx
··· 47 47 48 48 const onPressLoadLatest = React.useCallback(() => { 49 49 scrollToTop() 50 - queryClient.invalidateQueries({queryKey: NOTIFS_RQKEY()}) 50 + queryClient.invalidateQueries({ 51 + queryKey: NOTIFS_RQKEY(), 52 + }) 51 53 }, [scrollToTop, queryClient]) 52 54 53 55 // on-visible setup