Log to Sentry whenever users encounter Bluesky feed errors (#2999)
parent
58aaad704a
commit
c8d02a791a
|
@ -75,3 +75,9 @@ export const HITSLOP_20 = createHitslop(20)
|
||||||
export const HITSLOP_30 = createHitslop(30)
|
export const HITSLOP_30 = createHitslop(30)
|
||||||
export const BACK_HITSLOP = HITSLOP_30
|
export const BACK_HITSLOP = HITSLOP_30
|
||||||
export const MAX_POST_LINES = 25
|
export const MAX_POST_LINES = 25
|
||||||
|
|
||||||
|
export const BSKY_FEED_OWNER_DIDS = [
|
||||||
|
'did:plc:z72i7hdynmk6r22z27h6tvur',
|
||||||
|
'did:plc:vpkhqolt662uhesyj6nxm7ys',
|
||||||
|
'did:plc:q6gjnaw2blty4crticxkmujt',
|
||||||
|
]
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
import React, {useCallback, useEffect, useRef} from 'react'
|
import React, {useCallback, useEffect, useRef} from 'react'
|
||||||
import {AppState} from 'react-native'
|
import {AppState} from 'react-native'
|
||||||
import {AppBskyFeedDefs, AppBskyFeedPost, PostModeration} from '@atproto/api'
|
import {
|
||||||
|
AppBskyFeedDefs,
|
||||||
|
AppBskyFeedPost,
|
||||||
|
AtUri,
|
||||||
|
PostModeration,
|
||||||
|
} from '@atproto/api'
|
||||||
import {
|
import {
|
||||||
useInfiniteQuery,
|
useInfiniteQuery,
|
||||||
InfiniteData,
|
InfiniteData,
|
||||||
|
@ -29,6 +34,7 @@ import {KnownError} from '#/view/com/posts/FeedErrorMessage'
|
||||||
import {embedViewRecordToPostView, getEmbeddedPost} from './util'
|
import {embedViewRecordToPostView, getEmbeddedPost} from './util'
|
||||||
import {useModerationOpts} from './preferences'
|
import {useModerationOpts} from './preferences'
|
||||||
import {queryClient} from 'lib/react-query'
|
import {queryClient} from 'lib/react-query'
|
||||||
|
import {BSKY_FEED_OWNER_DIDS} from 'lib/constants'
|
||||||
|
|
||||||
type ActorDid = string
|
type ActorDid = string
|
||||||
type AuthorFilter =
|
type AuthorFilter =
|
||||||
|
@ -137,24 +143,41 @@ export function usePostFeedQuery(
|
||||||
cursor: undefined,
|
cursor: undefined,
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await api.fetch({cursor, limit: PAGE_SIZE})
|
try {
|
||||||
precacheFeedPostProfiles(queryClient, res.feed)
|
const res = await api.fetch({cursor, limit: PAGE_SIZE})
|
||||||
|
precacheFeedPostProfiles(queryClient, res.feed)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this is a public view, we need to check if posts fail moderation.
|
* If this is a public view, we need to check if posts fail moderation.
|
||||||
* If all fail, we throw an error. If only some fail, we continue and let
|
* If all fail, we throw an error. If only some fail, we continue and let
|
||||||
* moderations happen later, which results in some posts being shown and
|
* moderations happen later, which results in some posts being shown and
|
||||||
* some not.
|
* some not.
|
||||||
*/
|
*/
|
||||||
if (!getAgent().session) {
|
if (!getAgent().session) {
|
||||||
assertSomePostsPassModeration(res.feed)
|
assertSomePostsPassModeration(res.feed)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
api,
|
api,
|
||||||
cursor: res.cursor,
|
cursor: res.cursor,
|
||||||
feed: res.feed,
|
feed: res.feed,
|
||||||
fetchedAt: Date.now(),
|
fetchedAt: Date.now(),
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
const feedDescParts = feedDesc.split('|')
|
||||||
|
const feedOwnerDid = new AtUri(feedDescParts[1]).hostname
|
||||||
|
|
||||||
|
if (
|
||||||
|
feedDescParts[0] === 'feedgen' &&
|
||||||
|
BSKY_FEED_OWNER_DIDS.includes(feedOwnerDid)
|
||||||
|
) {
|
||||||
|
logger.error(`Bluesky feed may be offline: ${feedOwnerDid}`, {
|
||||||
|
feedDesc,
|
||||||
|
jsError: e,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
throw e
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
initialPageParam: undefined,
|
initialPageParam: undefined,
|
||||||
|
|
Loading…
Reference in New Issue