Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

Log to Sentry whenever users encounter Bluesky feed errors (#2999)

authored by

Hailey and committed by
GitHub
c8d02a79 58aaad70

+46 -17
+6
src/lib/constants.ts
··· 75 75 export const HITSLOP_30 = createHitslop(30) 76 76 export const BACK_HITSLOP = HITSLOP_30 77 77 export const MAX_POST_LINES = 25 78 + 79 + export const BSKY_FEED_OWNER_DIDS = [ 80 + 'did:plc:z72i7hdynmk6r22z27h6tvur', 81 + 'did:plc:vpkhqolt662uhesyj6nxm7ys', 82 + 'did:plc:q6gjnaw2blty4crticxkmujt', 83 + ]
+40 -17
src/state/queries/post-feed.ts
··· 1 1 import React, {useCallback, useEffect, useRef} from 'react' 2 2 import {AppState} from 'react-native' 3 - import {AppBskyFeedDefs, AppBskyFeedPost, PostModeration} from '@atproto/api' 3 + import { 4 + AppBskyFeedDefs, 5 + AppBskyFeedPost, 6 + AtUri, 7 + PostModeration, 8 + } from '@atproto/api' 4 9 import { 5 10 useInfiniteQuery, 6 11 InfiniteData, ··· 29 34 import {embedViewRecordToPostView, getEmbeddedPost} from './util' 30 35 import {useModerationOpts} from './preferences' 31 36 import {queryClient} from 'lib/react-query' 37 + import {BSKY_FEED_OWNER_DIDS} from 'lib/constants' 32 38 33 39 type ActorDid = string 34 40 type AuthorFilter = ··· 137 143 cursor: undefined, 138 144 } 139 145 140 - const res = await api.fetch({cursor, limit: PAGE_SIZE}) 141 - precacheFeedPostProfiles(queryClient, res.feed) 146 + try { 147 + const res = await api.fetch({cursor, limit: PAGE_SIZE}) 148 + precacheFeedPostProfiles(queryClient, res.feed) 149 + 150 + /* 151 + * If this is a public view, we need to check if posts fail moderation. 152 + * If all fail, we throw an error. If only some fail, we continue and let 153 + * moderations happen later, which results in some posts being shown and 154 + * some not. 155 + */ 156 + if (!getAgent().session) { 157 + assertSomePostsPassModeration(res.feed) 158 + } 159 + 160 + return { 161 + api, 162 + cursor: res.cursor, 163 + feed: res.feed, 164 + fetchedAt: Date.now(), 165 + } 166 + } catch (e) { 167 + const feedDescParts = feedDesc.split('|') 168 + const feedOwnerDid = new AtUri(feedDescParts[1]).hostname 142 169 143 - /* 144 - * If this is a public view, we need to check if posts fail moderation. 145 - * If all fail, we throw an error. If only some fail, we continue and let 146 - * moderations happen later, which results in some posts being shown and 147 - * some not. 148 - */ 149 - if (!getAgent().session) { 150 - assertSomePostsPassModeration(res.feed) 151 - } 170 + if ( 171 + feedDescParts[0] === 'feedgen' && 172 + BSKY_FEED_OWNER_DIDS.includes(feedOwnerDid) 173 + ) { 174 + logger.error(`Bluesky feed may be offline: ${feedOwnerDid}`, { 175 + feedDesc, 176 + jsError: e, 177 + }) 178 + } 152 179 153 - return { 154 - api, 155 - cursor: res.cursor, 156 - feed: res.feed, 157 - fetchedAt: Date.now(), 180 + throw e 158 181 } 159 182 }, 160 183 initialPageParam: undefined,