Rework the me.follows cache to reduce network load (#384)

This commit is contained in:
Paul Frazee 2023-04-03 19:50:46 -05:00 committed by GitHub
parent 50f7f9877f
commit 25cc5b997f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 97 additions and 75 deletions

View file

@ -8,6 +8,7 @@ import {
import {RootStoreModel} from '../root-store'
import * as apilib from 'lib/api/index'
import {cleanError} from 'lib/strings/errors'
import {FollowState} from '../cache/my-follows'
export const ACTOR_TYPE_USER = 'app.bsky.system.actorUser'
@ -89,9 +90,10 @@ export class ProfileModel {
}
const follows = this.rootStore.me.follows
const followUri = follows.isFollowing(this.did)
? follows.getFollowUri(this.did)
: undefined
const followUri =
(await follows.fetchFollowState(this.did)) === FollowState.Following
? follows.getFollowUri(this.did)
: undefined
// guard against this view getting out of sync with the follows cache
if (followUri !== this.viewer.following) {