Fix poll latest loop (#1901)
* Avoid pollLatest loop * Set poll interval on profile feedszio/stable
parent
3fde1bea1b
commit
c687172de9
|
@ -106,6 +106,9 @@ export function Feed({
|
||||||
checkForNewRef.current = checkForNew
|
checkForNewRef.current = checkForNew
|
||||||
}, [checkForNew])
|
}, [checkForNew])
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
|
if (!pollInterval) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const i = setInterval(() => checkForNewRef.current?.(), pollInterval)
|
const i = setInterval(() => checkForNewRef.current?.(), pollInterval)
|
||||||
return () => clearInterval(i)
|
return () => clearInterval(i)
|
||||||
}, [pollInterval])
|
}, [pollInterval])
|
||||||
|
|
|
@ -350,6 +350,7 @@ const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>(
|
||||||
<Feed
|
<Feed
|
||||||
testID="postsFeed"
|
testID="postsFeed"
|
||||||
feed={feed}
|
feed={feed}
|
||||||
|
pollInterval={30e3}
|
||||||
scrollElRef={scrollElRef}
|
scrollElRef={scrollElRef}
|
||||||
onHasNew={setHasNew}
|
onHasNew={setHasNew}
|
||||||
onScroll={onScroll}
|
onScroll={onScroll}
|
||||||
|
|
Loading…
Reference in New Issue