diff options
Diffstat (limited to 'src/state/models/cache/my-follows.ts')
-rw-r--r-- | src/state/models/cache/my-follows.ts | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/state/models/cache/my-follows.ts b/src/state/models/cache/my-follows.ts index 725b7841e..14eeaae21 100644 --- a/src/state/models/cache/my-follows.ts +++ b/src/state/models/cache/my-follows.ts @@ -1,15 +1,12 @@ import {makeAutoObservable, runInAction} from 'mobx' -import {FollowRecord, AppBskyActorProfile, AppBskyActorRef} from '@atproto/api' +import {FollowRecord, AppBskyActorDefs} from '@atproto/api' import {RootStoreModel} from '../root-store' import {bundleAsync} from 'lib/async/bundle' const CACHE_TTL = 1000 * 60 * 60 // hourly type FollowsListResponse = Awaited<ReturnType<FollowRecord['list']>> type FollowsListResponseRecord = FollowsListResponse['records'][0] -type Profile = - | AppBskyActorProfile.ViewBasic - | AppBskyActorProfile.View - | AppBskyActorRef.WithInfo +type Profile = AppBskyActorDefs.ProfileViewBasic | AppBskyActorDefs.ProfileView /** * This model is used to maintain a synced local cache of the user's @@ -53,21 +50,21 @@ export class MyFollowsCache { fetch = bundleAsync(async () => { this.rootStore.log.debug('MyFollowsModel:fetch running full fetch') - let before + let rkeyStart let records: FollowsListResponseRecord[] = [] do { const res: FollowsListResponse = - await this.rootStore.api.app.bsky.graph.follow.list({ - user: this.rootStore.me.did, - before, + await this.rootStore.agent.app.bsky.graph.follow.list({ + repo: this.rootStore.me.did, + rkeyStart, }) records = records.concat(res.records) - before = res.cursor - } while (typeof before !== 'undefined') + rkeyStart = res.cursor + } while (typeof rkeyStart !== 'undefined') runInAction(() => { this.followDidToRecordMap = {} for (const record of records) { - this.followDidToRecordMap[record.value.subject.did] = record.uri + this.followDidToRecordMap[record.value.subject] = record.uri } this.lastSync = Date.now() this.myDid = this.rootStore.me.did |