about summary refs log tree commit diff
path: root/src/state/models/content/profile.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-04-03 19:50:46 -0500
committerGitHub <noreply@github.com>2023-04-03 19:50:46 -0500
commit25cc5b997f07daaeb64ef434992cb95892546ff5 (patch)
tree09531de05bbce7edddc9b5d48cb4cd56bdabcf90 /src/state/models/content/profile.ts
parent50f7f9877ff000fac3a22d4432253f91657b7e61 (diff)
downloadvoidsky-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.ts8
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) {