Reduce web requests (#2420)
* Stop auto-refetching app passwords and invites on an interval * Don't poll for posts or notifs if the app/tab isnt focused
This commit is contained in:
parent
8a4a8af61c
commit
db62f27241
4 changed files with 8 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
import React, {useCallback, useEffect, useRef} from 'react'
|
||||
import {AppState} from 'react-native'
|
||||
import {AppBskyFeedDefs, AppBskyFeedPost, PostModeration} from '@atproto/api'
|
||||
import {
|
||||
useInfiniteQuery,
|
||||
|
@ -312,6 +313,9 @@ export async function pollLatest(page: FeedPage | undefined) {
|
|||
if (!page) {
|
||||
return false
|
||||
}
|
||||
if (AppState.currentState !== 'active') {
|
||||
return
|
||||
}
|
||||
|
||||
logger.debug('usePostFeedQuery: pollLatest')
|
||||
const post = await page.api.peekLatest()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue