Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Paul Frazee and committed by
GitHub
99cf6b62 ab040741

+17 -24
+1
src/state/queries/notifications/feed.ts
··· 76 76 queryClient, 77 77 moderationOpts, 78 78 threadMutes, 79 + fetchAdditionalData: true, 79 80 }) 80 81 } 81 82
+4
src/state/queries/notifications/unread.tsx
··· 102 102 queryClient, 103 103 moderationOpts, 104 104 threadMutes, 105 + 106 + // only fetch subjects when the page is going to be used 107 + // in the notifications query, otherwise skip it 108 + fetchAdditionalData: !!invalidate, 105 109 }) 106 110 const unreadCount = countUnread(page) 107 111 const unreadCountStr =
+10 -6
src/state/queries/notifications/util.ts
··· 27 27 queryClient, 28 28 moderationOpts, 29 29 threadMutes, 30 + fetchAdditionalData, 30 31 }: { 31 32 cursor: string | undefined 32 33 limit: number 33 34 queryClient: QueryClient 34 35 moderationOpts: ModerationOpts | undefined 35 36 threadMutes: string[] 37 + fetchAdditionalData: boolean 36 38 }): Promise<FeedPage> { 37 39 const res = await getAgent().listNotifications({ 38 40 limit, ··· 49 51 50 52 // we fetch subjects of notifications (usually posts) now instead of lazily 51 53 // in the UI to avoid relayouts 52 - const subjects = await fetchSubjects(notifsGrouped) 53 - for (const notif of notifsGrouped) { 54 - if (notif.subjectUri) { 55 - notif.subject = subjects.get(notif.subjectUri) 56 - if (notif.subject) { 57 - precacheResolvedUri(queryClient, notif.subject.author) // precache the handle->did resolution 54 + if (fetchAdditionalData) { 55 + const subjects = await fetchSubjects(notifsGrouped) 56 + for (const notif of notifsGrouped) { 57 + if (notif.subjectUri) { 58 + notif.subject = subjects.get(notif.subjectUri) 59 + if (notif.subject) { 60 + precacheResolvedUri(queryClient, notif.subject.author) // precache the handle->did resolution 61 + } 58 62 } 59 63 } 60 64 }
+2 -17
src/view/com/composer/Composer.tsx
··· 14 14 import {useSafeAreaInsets} from 'react-native-safe-area-context' 15 15 import LinearGradient from 'react-native-linear-gradient' 16 16 import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' 17 - import {AppBskyFeedGetPosts, RichText} from '@atproto/api' 17 + import {RichText} from '@atproto/api' 18 18 import {useAnalytics} from 'lib/analytics/analytics' 19 19 import {useIsKeyboardVisible} from 'lib/hooks/useIsKeyboardVisible' 20 20 import {ExternalEmbed} from './ExternalEmbed' ··· 60 60 import {useSession, getAgent} from '#/state/session' 61 61 import {useProfileQuery} from '#/state/queries/profile' 62 62 import {useComposerControls} from '#/state/shell/composer' 63 - import {until} from '#/lib/async/until' 64 63 import {emitPostCreated} from '#/state/events' 65 64 import {ThreadgateSetting} from '#/state/queries/threadgate' 66 65 ··· 246 245 if (replyTo && replyTo.uri) track('Post:Reply') 247 246 } 248 247 if (postUri && !replyTo) { 249 - whenAppViewReady(postUri).then(() => { 250 - emitPostCreated() 251 - }) 248 + emitPostCreated() 252 249 } 253 250 setLangPrefs.savePostLanguageToHistory() 254 251 onPost?.() ··· 553 550 borderTopWidth: 1, 554 551 }, 555 552 }) 556 - 557 - async function whenAppViewReady(uri: string) { 558 - await until( 559 - 5, // 5 tries 560 - 1e3, // 1s delay between tries 561 - (res: AppBskyFeedGetPosts.Response) => !!res.data.posts[0], 562 - () => 563 - getAgent().getPosts({ 564 - uris: [uri], 565 - }), 566 - ) 567 - }
-1
src/view/screens/Profile.tsx
··· 441 441 testID="postsFeed" 442 442 enabled={isFocused} 443 443 feed={feed} 444 - pollInterval={30e3} 445 444 scrollElRef={scrollElRef} 446 445 onHasNew={setHasNew} 447 446 onScroll={onScroll}