diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-12-11 13:53:37 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-11 13:53:37 -0800 |
commit | 99cf6b626fd955b94bde04c2153cbe8bad53699d (patch) | |
tree | 670015b6d4ffac1823b2c85a72e9d4991e7c76fc /src/view | |
parent | ab04074197f8432a3d502ca2393beca3b8f6ca97 (diff) | |
download | voidsky-99cf6b626fd955b94bde04c2153cbe8bad53699d.tar.zst |
Additional reductions in request traffic (#2169)
* Dont poll for new content on profiles * Drop the whenAppReady query after new post to reduce traffic overhead * Reduce getPosts calls in notifs to only use them when needed
Diffstat (limited to 'src/view')
-rw-r--r-- | src/view/com/composer/Composer.tsx | 19 | ||||
-rw-r--r-- | src/view/screens/Profile.tsx | 1 |
2 files changed, 2 insertions, 18 deletions
diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index 97d443451..f510be0be 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -14,7 +14,7 @@ import { import {useSafeAreaInsets} from 'react-native-safe-area-context' import LinearGradient from 'react-native-linear-gradient' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' -import {AppBskyFeedGetPosts, RichText} from '@atproto/api' +import {RichText} from '@atproto/api' import {useAnalytics} from 'lib/analytics/analytics' import {useIsKeyboardVisible} from 'lib/hooks/useIsKeyboardVisible' import {ExternalEmbed} from './ExternalEmbed' @@ -60,7 +60,6 @@ import { import {useSession, getAgent} from '#/state/session' import {useProfileQuery} from '#/state/queries/profile' import {useComposerControls} from '#/state/shell/composer' -import {until} from '#/lib/async/until' import {emitPostCreated} from '#/state/events' import {ThreadgateSetting} from '#/state/queries/threadgate' @@ -246,9 +245,7 @@ export const ComposePost = observer(function ComposePost({ if (replyTo && replyTo.uri) track('Post:Reply') } if (postUri && !replyTo) { - whenAppViewReady(postUri).then(() => { - emitPostCreated() - }) + emitPostCreated() } setLangPrefs.savePostLanguageToHistory() onPost?.() @@ -553,15 +550,3 @@ const styles = StyleSheet.create({ borderTopWidth: 1, }, }) - -async function whenAppViewReady(uri: string) { - await until( - 5, // 5 tries - 1e3, // 1s delay between tries - (res: AppBskyFeedGetPosts.Response) => !!res.data.posts[0], - () => - getAgent().getPosts({ - uris: [uri], - }), - ) -} diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx index e019c4ede..b7dac8c6d 100644 --- a/src/view/screens/Profile.tsx +++ b/src/view/screens/Profile.tsx @@ -441,7 +441,6 @@ const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>( testID="postsFeed" enabled={isFocused} feed={feed} - pollInterval={30e3} scrollElRef={scrollElRef} onHasNew={setHasNew} onScroll={onScroll} |