Feed and notifs improvements (#498)

* Reduce frequency of the notifications sync

* Reduce frequency of home feed polling

* Ensure loading spinner is visible in notifications

* Render notifications loading spinner in the flatlist

* Fixes and performance improvements to notifications

* Render 30+ on notifications if at max

* Fix issue with repeating posts in home feed

* Dont check for unread notifs if we're already at max
This commit is contained in:
Paul Frazee 2023-04-19 20:11:10 -05:00 committed by GitHub
parent b24ba3adc9
commit 04e0ebe8fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 130 additions and 150 deletions

View file

@ -20,6 +20,7 @@ import {ComposeIcon2} from 'lib/icons'
import {isDesktopWeb} from 'platform/detection'
const HEADER_OFFSET = isDesktopWeb ? 50 : 40
const POLL_FREQ = 30e3 // 30sec
type Props = NativeStackScreenProps<HomeTabNavigatorParams, 'Home'>
export const HomeScreen = withAuthRequired((_opts: Props) => {
@ -150,7 +151,7 @@ const FeedPage = observer(
React.useCallback(() => {
const softResetSub = store.onScreenSoftReset(onSoftReset)
const feedCleanup = feed.registerListeners()
const pollInterval = setInterval(doPoll, 15e3)
const pollInterval = setInterval(doPoll, POLL_FREQ)
screen('Feed')
store.log.debug('HomeScreen: Updating feed')
@ -176,8 +177,8 @@ const FeedPage = observer(
}, [feed])
const onPressLoadLatest = React.useCallback(() => {
feed.resetToLatest()
scrollToTop()
feed.refresh()
}, [feed, scrollToTop])
return (