diff options
Diffstat (limited to 'src/state/models/my-follows.ts')
-rw-r--r-- | src/state/models/my-follows.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/state/models/my-follows.ts b/src/state/models/my-follows.ts index 252e8a3d3..c1fba1352 100644 --- a/src/state/models/my-follows.ts +++ b/src/state/models/my-follows.ts @@ -20,6 +20,7 @@ export class MyFollowsModel { // data followDidToRecordMap: Record<string, string> = {} lastSync = 0 + myDid?: string constructor(public rootStore: RootStoreModel) { makeAutoObservable( @@ -36,6 +37,7 @@ export class MyFollowsModel { fetchIfNeeded = bundleAsync(async () => { if ( + this.myDid !== this.rootStore.me.did || Object.keys(this.followDidToRecordMap).length === 0 || Date.now() - this.lastSync > CACHE_TTL ) { @@ -62,6 +64,7 @@ export class MyFollowsModel { this.followDidToRecordMap[record.value.subject.did] = record.uri } this.lastSync = Date.now() + this.myDid = this.rootStore.me.did }) }) @@ -69,6 +72,10 @@ export class MyFollowsModel { return !!this.followDidToRecordMap[did] } + get isEmpty() { + return Object.keys(this.followDidToRecordMap).length === 0 + } + getFollowUri(did: string): string { const v = this.followDidToRecordMap[did] if (!v) { |