Fix to extraneous home feed polling
parent
41337f6d17
commit
5da45cd8cd
|
@ -1,5 +1,5 @@
|
|||
import React from 'react'
|
||||
import {Image, StyleSheet, StyleProp, View, ViewStyle} from 'react-native'
|
||||
import {StyleSheet, StyleProp, View, ViewStyle} from 'react-native'
|
||||
import {AppBskyEmbedImages, AppBskyEmbedExternal} from '@atproto/api'
|
||||
import LinearGradient from 'react-native-linear-gradient'
|
||||
import {Link} from '../util/Link'
|
||||
|
@ -10,7 +10,6 @@ import {ImagesLightbox} from '../../../state/models/shell-ui'
|
|||
import {useStores} from '../../../state'
|
||||
import {usePalette} from '../../lib/hooks/usePalette'
|
||||
import {gradients} from '../../lib/styles'
|
||||
import {DEF_AVATAR} from '../../lib/assets'
|
||||
|
||||
type Embed =
|
||||
| AppBskyEmbedImages.Presented
|
||||
|
|
|
@ -47,11 +47,15 @@ export const Home = observer(function Home({
|
|||
|
||||
useEffect(() => {
|
||||
const pollInterval = setInterval(() => doPoll(), 15e3)
|
||||
const cleanup = () => {
|
||||
clearInterval(pollInterval)
|
||||
}
|
||||
|
||||
if (!visible) {
|
||||
setWasVisible(false)
|
||||
return
|
||||
return cleanup
|
||||
} else if (wasVisible) {
|
||||
return
|
||||
return cleanup
|
||||
}
|
||||
setWasVisible(true)
|
||||
|
||||
|
@ -62,9 +66,7 @@ export const Home = observer(function Home({
|
|||
} else {
|
||||
store.me.mainFeed.setup()
|
||||
}
|
||||
return () => {
|
||||
clearInterval(pollInterval)
|
||||
}
|
||||
return cleanup
|
||||
}, [visible, store, navIdx, doPoll, wasVisible])
|
||||
|
||||
const onPressCompose = () => {
|
||||
|
|
Loading…
Reference in New Issue