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 const { 40 data, 41 dataUpdatedAt, 42 isFetching, 43 isFetched, 44 isError, ··· 139 [onPressRetryLoadMore, dataUpdatedAt, moderationOpts], 140 ) 141 142 const FeedFooter = React.useCallback( 143 () => 144 isFetchingNextPage ? ( ··· 168 data={items} 169 keyExtractor={item => item._reactKey} 170 renderItem={renderItem} 171 - ListHeaderComponent={ListHeaderComponent} 172 ListFooterComponent={FeedFooter} 173 refreshControl={ 174 <RefreshControl
··· 39 const { 40 data, 41 dataUpdatedAt, 42 + isLoading, 43 isFetching, 44 isFetched, 45 isError, ··· 140 [onPressRetryLoadMore, dataUpdatedAt, moderationOpts], 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 + 158 const FeedFooter = React.useCallback( 159 () => 160 isFetchingNextPage ? ( ··· 184 data={items} 185 keyExtractor={item => item._reactKey} 186 renderItem={renderItem} 187 + ListHeaderComponent={FeedHeader} 188 ListFooterComponent={FeedFooter} 189 refreshControl={ 190 <RefreshControl
+3 -1
src/view/screens/Notifications.tsx
··· 47 48 const onPressLoadLatest = React.useCallback(() => { 49 scrollToTop() 50 - queryClient.invalidateQueries({queryKey: NOTIFS_RQKEY()}) 51 }, [scrollToTop, queryClient]) 52 53 // on-visible setup
··· 47 48 const onPressLoadLatest = React.useCallback(() => { 49 scrollToTop() 50 + queryClient.invalidateQueries({ 51 + queryKey: NOTIFS_RQKEY(), 52 + }) 53 }, [scrollToTop, queryClient]) 54 55 // on-visible setup