Skip to content

Commit

Permalink
Fix poll latest loop (#1901)
Browse files Browse the repository at this point in the history
* Avoid pollLatest loop

* Set poll interval on profile feeds
  • Loading branch information
pfrazee authored Nov 14, 2023
1 parent 3fde1be commit c687172
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/view/com/posts/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
1 change: 1 addition & 0 deletions src/view/screens/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>(
<Feed
testID="postsFeed"
feed={feed}
pollInterval={30e3}
scrollElRef={scrollElRef}
onHasNew={setHasNew}
onScroll={onScroll}
Expand Down

0 comments on commit c687172

Please sign in to comment.