Add additional try catch

This commit is contained in:
Eric Bailey
2023-11-14 11:19:42 -06:00
parent 9f3d8e05a5
commit 2549f9e4e7
@@ -14,6 +14,7 @@ import {RecommendedFollowsItem} from './RecommendedFollowsItem'
import {useSuggestedFollowsQuery} from '#/state/queries/suggested-follows'
import {useGetSuggestedFollowersByActor} from '#/state/queries/suggested-follows'
import {useModerationOpts} from '#/state/queries/preferences'
import {logger} from '#/logger'
type Props = {
next: () => void
@@ -117,6 +118,7 @@ export const RecommendedFollows = observer(function RecommendedFollowsImpl({
const onFollowStateChange = React.useCallback(
async ({following, did}: {following: boolean; did: string}) => {
if (following) {
try {
const {suggestions: results} = await getSuggestedFollowsByActor(did)
if (results.length) {
@@ -128,6 +130,11 @@ export const RecommendedFollows = observer(function RecommendedFollowsImpl({
[did]: deduped.slice(0, 3),
}))
}
} catch (e) {
logger.error('RecommendedFollows: failed to get suggestions', {
error: e,
})
}
}
// not handling the unfollow case