Introduce an image sizes cache to improve feed layouts (close #213) (#335)

* Introduce an image sizes cache to improve feed layouts (close #213)

* Clear out resolved promises from the image cache
This commit is contained in:
Paul Frazee 2023-03-21 12:59:10 -05:00 committed by GitHub
parent c1d454b7cf
commit 858d4c8c88
7 changed files with 92 additions and 30 deletions

View file

@ -2,7 +2,7 @@ import {makeAutoObservable, runInAction} from 'mobx'
import {RootStoreModel} from './root-store'
import {FeedModel} from './feed-view'
import {NotificationsViewModel} from './notifications-view'
import {MyFollowsModel} from './my-follows'
import {MyFollowsCache} from './cache/my-follows'
import {isObj, hasProp} from 'lib/type-guards'
export class MeModel {
@ -15,7 +15,7 @@ export class MeModel {
followersCount: number | undefined
mainFeed: FeedModel
notifications: NotificationsViewModel
follows: MyFollowsModel
follows: MyFollowsCache
constructor(public rootStore: RootStoreModel) {
makeAutoObservable(
@ -27,7 +27,7 @@ export class MeModel {
algorithm: 'reverse-chronological',
})
this.notifications = new NotificationsViewModel(this.rootStore, {})
this.follows = new MyFollowsModel(this.rootStore)
this.follows = new MyFollowsCache(this.rootStore)
}
clear() {