Bluesky app fork with some witchin' additions 💫 witchsky.app
bluesky fork client
122
fork

Configure Feed

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

Handle failed pinned feed fetches when rendering list of pinned feeds (#2173)

authored by

Eric Bailey and committed by
GitHub
586c2417 52ffd6aa

+32 -19
+32 -19
src/state/queries/feed.ts
··· 15 15 AppBskyUnspeccedGetPopularFeedGenerators, 16 16 } from '@atproto/api' 17 17 18 + import {logger} from '#/logger' 18 19 import {router} from '#/routes' 19 20 import {sanitizeDisplayName} from '#/lib/strings/display-names' 20 21 import {sanitizeHandle} from '#/lib/strings/handles' ··· 289 290 reqs.push(cached) 290 291 } else { 291 292 reqs.push( 292 - queryClient.fetchQuery({ 293 - queryKey: feedSourceInfoQueryKey({uri}), 294 - queryFn: async () => { 295 - const type = getFeedTypeFromUri(uri) 293 + (async () => { 294 + // these requests can fail, need to filter those out 295 + try { 296 + return await queryClient.fetchQuery({ 297 + queryKey: feedSourceInfoQueryKey({uri}), 298 + queryFn: async () => { 299 + const type = getFeedTypeFromUri(uri) 296 300 297 - if (type === 'feed') { 298 - const res = await getAgent().app.bsky.feed.getFeedGenerator({ 299 - feed: uri, 300 - }) 301 - return hydrateFeedGenerator(res.data.view) 302 - } else { 303 - const res = await getAgent().app.bsky.graph.getList({ 304 - list: uri, 305 - limit: 1, 306 - }) 307 - return hydrateList(res.data.list) 308 - } 309 - }, 310 - }), 301 + if (type === 'feed') { 302 + const res = 303 + await getAgent().app.bsky.feed.getFeedGenerator({ 304 + feed: uri, 305 + }) 306 + return hydrateFeedGenerator(res.data.view) 307 + } else { 308 + const res = await getAgent().app.bsky.graph.getList({ 309 + list: uri, 310 + limit: 1, 311 + }) 312 + return hydrateList(res.data.list) 313 + } 314 + }, 315 + }) 316 + } catch (e) { 317 + logger.warn(`usePinnedFeedsInfos: failed to fetch ${uri}`, { 318 + error: e, 319 + }) 320 + } 321 + })(), 311 322 ) 312 323 } 313 324 } 314 325 315 - const views = await Promise.all(reqs) 326 + const views = (await Promise.all(reqs)).filter( 327 + Boolean, 328 + ) as FeedSourceInfo[] 316 329 317 330 setTabs([FOLLOWING_FEED_STUB].concat(views)) 318 331 }