Fix to extraneous home feed polling

This commit is contained in:
Paul Frazee 2023-01-17 16:49:11 -06:00
parent 41337f6d17
commit 5da45cd8cd
2 changed files with 8 additions and 7 deletions

View file

@ -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 = () => {