diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-11-14 10:33:05 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-14 12:33:05 -0600 |
commit | c687172de96bd6aa85d3aa025c2e0f024640f345 (patch) | |
tree | b6a3256767b01727e41b196c1265f0e37e6b72b4 | |
parent | 3fde1bea1bffecb6740f261b88ceb34134e0d418 (diff) | |
download | voidsky-c687172de96bd6aa85d3aa025c2e0f024640f345.tar.zst |
Fix poll latest loop (#1901)
* Avoid pollLatest loop * Set poll interval on profile feeds
-rw-r--r-- | src/view/com/posts/Feed.tsx | 3 | ||||
-rw-r--r-- | src/view/screens/Profile.tsx | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/view/com/posts/Feed.tsx b/src/view/com/posts/Feed.tsx index 6cbad7f71..5c9d1ad2c 100644 --- a/src/view/com/posts/Feed.tsx +++ b/src/view/com/posts/Feed.tsx @@ -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]) diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx index 1a2982027..724c47c95 100644 --- a/src/view/screens/Profile.tsx +++ b/src/view/screens/Profile.tsx @@ -350,6 +350,7 @@ const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>( <Feed testID="postsFeed" feed={feed} + pollInterval={30e3} scrollElRef={scrollElRef} onHasNew={setHasNew} onScroll={onScroll} |