mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

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

[Session] Drill `getAgent` into `Onboarding/util` (#3704)

* Drill agent into Onboarding/util

(cherry picked from commit 2ba68eb5e446a694730b720f2a5b3307eb0914ef)

* Thread getAgent instead

---------

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>

authored by

Eric Bailey
Dan Abramov
and committed by
GitHub
e5fdbfe2 35005da5

+16 -4
+1
src/screens/Onboarding/StepFinished.tsx
··· 57 57 try { 58 58 await Promise.all([ 59 59 bulkWriteFollows( 60 + getAgent, 60 61 suggestedAccountsStepResults.accountDids.concat(BSKY_APP_ACCOUNT_DID), 61 62 ), 62 63 // these must be serial
+15 -4
src/screens/Onboarding/util.ts
··· 1 - import {AppBskyGraphFollow, AppBskyGraphGetFollows} from '@atproto/api' 1 + import { 2 + AppBskyGraphFollow, 3 + AppBskyGraphGetFollows, 4 + BskyAgent, 5 + } from '@atproto/api' 2 6 3 7 import {until} from '#/lib/async/until' 4 - import {getAgent} from '#/state/session' 5 8 import {PRIMARY_FEEDS} from './StepAlgoFeeds' 6 9 7 10 function shuffle(array: any) { ··· 63 66 return Array.from(new Set(results)).slice(0, 20) 64 67 } 65 68 66 - export async function bulkWriteFollows(dids: string[]) { 69 + export async function bulkWriteFollows( 70 + getAgent: () => BskyAgent, 71 + dids: string[], 72 + ) { 67 73 const session = getAgent().session 68 74 69 75 if (!session) { ··· 87 93 repo: session.did, 88 94 writes: followWrites, 89 95 }) 90 - await whenFollowsIndexed(session.did, res => !!res.data.follows.length) 96 + await whenFollowsIndexed( 97 + getAgent, 98 + session.did, 99 + res => !!res.data.follows.length, 100 + ) 91 101 } 92 102 93 103 async function whenFollowsIndexed( 104 + getAgent: () => BskyAgent, 94 105 actor: string, 95 106 fn: (res: AppBskyGraphGetFollows.Response) => boolean, 96 107 ) {