Performance improvement (#937)
* Perf: Wait until a feed is visible in the home screen before fetching data * perf: update feed checkForLatest to use limit=1 * Fix lint
This commit is contained in:
parent
93689ad73d
commit
2e93e4a919
2 changed files with 37 additions and 46 deletions
|
@ -278,13 +278,11 @@ export class PostsFeedModel {
|
|||
* Check if new posts are available
|
||||
*/
|
||||
async checkForLatest() {
|
||||
if (this.hasNewLatest) {
|
||||
if (this.hasNewLatest || this.isLoading) {
|
||||
return
|
||||
}
|
||||
const res = await this._getFeed({limit: this.pageSize})
|
||||
const tuner = new FeedTuner()
|
||||
const slices = tuner.tune(res.data.feed, this.feedTuners)
|
||||
this.setHasNewLatest(slices[0]?.uri !== this.slices[0]?.uri)
|
||||
const res = await this._getFeed({limit: 1})
|
||||
this.setHasNewLatest(res.data.feed[0]?.post.uri !== this.pollCursor)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue