diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-04-03 19:50:46 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-03 19:50:46 -0500 |
commit | 25cc5b997f07daaeb64ef434992cb95892546ff5 (patch) | |
tree | 09531de05bbce7edddc9b5d48cb4cd56bdabcf90 /src/state/models/content/profile.ts | |
parent | 50f7f9877ff000fac3a22d4432253f91657b7e61 (diff) | |
download | voidsky-25cc5b997f07daaeb64ef434992cb95892546ff5.tar.zst |
Rework the me.follows cache to reduce network load (#384)
Diffstat (limited to 'src/state/models/content/profile.ts')
-rw-r--r-- | src/state/models/content/profile.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/state/models/content/profile.ts b/src/state/models/content/profile.ts index 08616bf18..8d9c71b39 100644 --- a/src/state/models/content/profile.ts +++ b/src/state/models/content/profile.ts @@ -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) { |