Bluesky app fork with some witchin' additions 💫

update follows when pressing follow all (#4663)

authored by hailey.at and committed by

GitHub 5641a439 878b0476

+22 -4
+12
src/screens/Onboarding/util.ts
··· 3 3 AppBskyGraphGetFollows, 4 4 BskyAgent, 5 5 } from '@atproto/api' 6 + import {TID} from '@atproto/common-web' 6 7 7 8 import {until} from '#/lib/async/until' 8 9 ··· 20 21 createdAt: new Date().toISOString(), 21 22 } 22 23 }) 24 + 23 25 const followWrites = followRecords.map(r => ({ 24 26 $type: 'com.atproto.repo.applyWrites#create', 25 27 collection: 'app.bsky.graph.follow', 28 + rkey: TID.nextStr(), 26 29 value: r, 27 30 })) 28 31 ··· 31 34 writes: followWrites, 32 35 }) 33 36 await whenFollowsIndexed(agent, session.did, res => !!res.data.follows.length) 37 + 38 + const followUris = new Map() 39 + for (const r of followWrites) { 40 + followUris.set( 41 + r.value.subject, 42 + `at://${session.did}/app.bsky.graph.follow/${r.rkey}`, 43 + ) 44 + } 45 + return followUris 34 46 } 35 47 36 48 async function whenFollowsIndexed(
+10 -4
src/screens/StarterPack/StarterPackScreen.tsx
··· 23 23 import {cleanError} from '#/lib/strings/errors' 24 24 import {logger} from '#/logger' 25 25 import {useDeleteStarterPackMutation} from '#/state/queries/starter-packs' 26 + import {batchedUpdates} from 'lib/batchedUpdates' 26 27 import {HITSLOP_20} from 'lib/constants' 27 28 import {makeProfileLink, makeStarterPackLink} from 'lib/routes/links' 28 29 import {CommonNavigatorParams, NavigationProp} from 'lib/routes/types' 29 30 import {logEvent} from 'lib/statsig/statsig' 30 31 import {getStarterPackOgCard} from 'lib/strings/starter-pack' 31 32 import {isWeb} from 'platform/detection' 33 + import {updateProfileShadow} from 'state/cache/profile-shadow' 32 34 import {useModerationOpts} from 'state/preferences/moderation-opts' 33 - import {RQKEY, useListMembersQuery} from 'state/queries/list-members' 35 + import {useListMembersQuery} from 'state/queries/list-members' 34 36 import {useResolveDidQuery} from 'state/queries/resolve-uri' 35 37 import {useShortenLink} from 'state/queries/shorten-link' 36 38 import {useStarterPackQuery} from 'state/queries/starter-packs' ··· 275 277 .filter(li => !li.subject.viewer?.following) 276 278 .map(li => li.subject.did) 277 279 278 - await bulkWriteFollows(agent, dids) 280 + const followUris = await bulkWriteFollows(agent, dids) 279 281 280 - await queryClient.refetchQueries({ 281 - queryKey: RQKEY(starterPack.list.uri), 282 + batchedUpdates(() => { 283 + for (let did of dids) { 284 + updateProfileShadow(queryClient, did, { 285 + followingUri: followUris.get(did), 286 + }) 287 + } 282 288 }) 283 289 284 290 logEvent('starterPack:followAll', {