diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-07-01 14:25:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-01 14:25:13 -0500 |
commit | 2e93e4a919c42ae13d93ec0b060b60119b1d6886 (patch) | |
tree | 502f70d531fcb23892423c5028942c4dd867f9b4 /src/state/models/feeds/posts.ts | |
parent | 93689ad73df449b476cbb69e79f0f6d9c09ebce1 (diff) | |
download | voidsky-2e93e4a919c42ae13d93ec0b060b60119b1d6886.tar.zst |
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
Diffstat (limited to 'src/state/models/feeds/posts.ts')
-rw-r--r-- | src/state/models/feeds/posts.ts | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/state/models/feeds/posts.ts b/src/state/models/feeds/posts.ts index cd5e3c056..4e6633d38 100644 --- a/src/state/models/feeds/posts.ts +++ b/src/state/models/feeds/posts.ts @@ -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) } /** |