diff options
Diffstat (limited to 'src/screens/Onboarding')
-rw-r--r-- | src/screens/Onboarding/StepFinished.tsx | 19 | ||||
-rw-r--r-- | src/screens/Onboarding/util.ts | 12 |
2 files changed, 19 insertions, 12 deletions
diff --git a/src/screens/Onboarding/StepFinished.tsx b/src/screens/Onboarding/StepFinished.tsx index 825a0e723..379807d8f 100644 --- a/src/screens/Onboarding/StepFinished.tsx +++ b/src/screens/Onboarding/StepFinished.tsx @@ -23,6 +23,7 @@ import {useProgressGuideControls} from '#/state/shell/progress-guide' import {uploadBlob} from 'lib/api' import {useRequestNotificationsPermission} from 'lib/notifications/notifications' import {useSetHasCheckedForStarterPack} from 'state/preferences/used-starter-packs' +import {getAllListMembers} from 'state/queries/list-members' import { useActiveStarterPack, useSetActiveStarterPack, @@ -73,18 +74,20 @@ export function StepFinished() { starterPack: activeStarterPack.uri, }) starterPack = spRes.data.starterPack - - if (starterPack.list) { - const listRes = await agent.app.bsky.graph.getList({ - list: starterPack.list.uri, - limit: 50, - }) - listItems = listRes.data.items - } } catch (e) { logger.error('Failed to fetch starter pack', {safeMessage: e}) // don't tell the user, just get them through onboarding. } + try { + if (starterPack?.list) { + listItems = await getAllListMembers(agent, starterPack.list.uri) + } + } catch (e) { + logger.error('Failed to fetch starter pack list items', { + safeMessage: e, + }) + // don't tell the user, just get them through onboarding. + } } try { diff --git a/src/screens/Onboarding/util.ts b/src/screens/Onboarding/util.ts index b9ecc4b98..14750f34c 100644 --- a/src/screens/Onboarding/util.ts +++ b/src/screens/Onboarding/util.ts @@ -4,6 +4,7 @@ import { BskyAgent, } from '@atproto/api' import {TID} from '@atproto/common-web' +import chunk from 'lodash.chunk' import {until} from '#/lib/async/until' @@ -29,10 +30,13 @@ export async function bulkWriteFollows(agent: BskyAgent, dids: string[]) { value: r, })) - await agent.com.atproto.repo.applyWrites({ - repo: session.did, - writes: followWrites, - }) + const chunks = chunk(followWrites, 50) + for (const chunk of chunks) { + await agent.com.atproto.repo.applyWrites({ + repo: session.did, + writes: chunk, + }) + } await whenFollowsIndexed(agent, session.did, res => !!res.data.follows.length) const followUris = new Map() |