Fix: fetch follows on desktop search for typeahead (#1660)
This commit is contained in:
parent
60c0db03f7
commit
d68b4ca856
2 changed files with 10 additions and 2 deletions
5
src/state/models/cache/my-follows.ts
vendored
5
src/state/models/cache/my-follows.ts
vendored
|
@ -5,6 +5,7 @@ import {
|
|||
moderateProfile,
|
||||
} from '@atproto/api'
|
||||
import {RootStoreModel} from '../root-store'
|
||||
import {bundleAsync} from 'lib/async/bundle'
|
||||
|
||||
const MAX_SYNC_PAGES = 10
|
||||
const SYNC_TTL = 60e3 * 10 // 10 minutes
|
||||
|
@ -56,7 +57,7 @@ export class MyFollowsCache {
|
|||
* Syncs a subset of the user's follows
|
||||
* for performance reasons, caps out at 1000 follows
|
||||
*/
|
||||
async syncIfNeeded() {
|
||||
syncIfNeeded = bundleAsync(async () => {
|
||||
if (this.lastSync > Date.now() - SYNC_TTL) {
|
||||
return
|
||||
}
|
||||
|
@ -81,7 +82,7 @@ export class MyFollowsCache {
|
|||
}
|
||||
|
||||
this.lastSync = Date.now()
|
||||
}
|
||||
})
|
||||
|
||||
getFollowState(did: string): FollowState {
|
||||
if (typeof this.byDid[did] === 'undefined') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue