diff options
author | Paul Frazee <pfrazee@gmail.com> | 2024-01-10 22:27:14 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-10 22:27:14 -0800 |
commit | 7ab4be6f7d5a89f752ebd989d9c730a9e135a989 (patch) | |
tree | b6d45ac19bf83af827268fb3c282d6db3643dcc1 /src/view/screens/Feeds.tsx | |
parent | 0442dcc1a01a613985155c86a5ee042085553f33 (diff) | |
download | voidsky-7ab4be6f7d5a89f752ebd989d9c730a9e135a989.tar.zst |
Reduce polling (#2465)
* Move profile and preference polling to polls-on-foreground * Refetch prefs on feeds screen refresh since polling no longer occurs * Reduce notifications polling by 50% if there's already an unread * Disable feed polling if we know we have content * Disable the hard refresh after 1 hour in case it's the cause of the random feed refresh bug * Fix types
Diffstat (limited to 'src/view/screens/Feeds.tsx')
-rw-r--r-- | src/view/screens/Feeds.tsx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/view/screens/Feeds.tsx b/src/view/screens/Feeds.tsx index e0126bd48..a913364d4 100644 --- a/src/view/screens/Feeds.tsx +++ b/src/view/screens/Feeds.tsx @@ -97,6 +97,7 @@ export function FeedsScreen(_props: Props) { data: preferences, isLoading: isPreferencesLoading, error: preferencesError, + refetch: refetchPreferences, } = usePreferencesQuery() const { data: popularFeeds, @@ -151,9 +152,12 @@ export function FeedsScreen(_props: Props) { }, [query, debouncedSearch]) const onPullToRefresh = React.useCallback(async () => { setIsPTR(true) - await refetchPopularFeeds() + await Promise.all([ + refetchPreferences().catch(_e => undefined), + refetchPopularFeeds().catch(_e => undefined), + ]) setIsPTR(false) - }, [setIsPTR, refetchPopularFeeds]) + }, [setIsPTR, refetchPreferences, refetchPopularFeeds]) const onEndReached = React.useCallback(() => { if ( isPopularFeedsFetching || |