Fix poll latest loop (#1901)

* Avoid pollLatest loop

* Set poll interval on profile feeds
zio/stable
Paul Frazee 2023-11-14 10:33:05 -08:00 committed by GitHub
parent 3fde1bea1b
commit c687172de9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -106,6 +106,9 @@ export function Feed({
checkForNewRef.current = checkForNew
}, [checkForNew])
React.useEffect(() => {
if (!pollInterval) {
return
}
const i = setInterval(() => checkForNewRef.current?.(), pollInterval)
return () => clearInterval(i)
}, [pollInterval])

View File

@ -350,6 +350,7 @@ const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>(
<Feed
testID="postsFeed"
feed={feed}
pollInterval={30e3}
scrollElRef={scrollElRef}
onHasNew={setHasNew}
onScroll={onScroll}