From 9dec9d72768c6217a3878c80b11cbbd3d9ed0ff9 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Fri, 1 Dec 2023 15:40:50 -0600 Subject: Only poll feed when feed page is focused (#2064) * Do no poll when screen is not focused * Avoid polling unless focused * Handle homepage in background * Fix the intl:check to ignore comments in diffs --------- Co-authored-by: Paul Frazee --- src/view/screens/ProfileList.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/view/screens/ProfileList.tsx') diff --git a/src/view/screens/ProfileList.tsx b/src/view/screens/ProfileList.tsx index 1396b8269..421611764 100644 --- a/src/view/screens/ProfileList.tsx +++ b/src/view/screens/ProfileList.tsx @@ -159,7 +159,13 @@ function ProfileListScreenLoaded({ isHeaderReady={true} renderHeader={renderHeader} onCurrentPageSelected={onCurrentPageSelected}> - {({onScroll, headerHeight, isScrolledDown, scrollElRef}) => ( + {({ + onScroll, + headerHeight, + isScrolledDown, + scrollElRef, + isFocused, + }) => ( )} {({onScroll, headerHeight, isScrolledDown, scrollElRef}) => ( @@ -519,10 +526,11 @@ interface FeedSectionProps { headerHeight: number isScrolledDown: boolean scrollElRef: React.MutableRefObject | null> + isFocused: boolean } const FeedSection = React.forwardRef( function FeedSectionImpl( - {feed, scrollElRef, onScroll, headerHeight, isScrolledDown}, + {feed, scrollElRef, onScroll, headerHeight, isScrolledDown, isFocused}, ref, ) { const queryClient = useQueryClient() @@ -545,6 +553,7 @@ const FeedSection = React.forwardRef(