From a63f97aef2ea70ff9f1b81d40073f36ae8e88278 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Thu, 3 Aug 2023 09:44:43 -0700 Subject: Use a post and handle-resolution cache to enable quick postthread loading (#1097) * Use a post and handle-resolution cache to enable quick postthread loading * Fix positioning of thread when loaded from cache and give more visual cues * Include parent posts in cache * Include notifications in cache --- src/state/models/feeds/posts.ts | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/state/models/feeds/posts.ts') diff --git a/src/state/models/feeds/posts.ts b/src/state/models/feeds/posts.ts index 4e6633d38..94d7228ed 100644 --- a/src/state/models/feeds/posts.ts +++ b/src/state/models/feeds/posts.ts @@ -374,6 +374,9 @@ export class PostsFeedModel { this.rootStore.me.follows.hydrateProfiles( res.data.feed.map(item => item.post.author), ) + for (const item of res.data.feed) { + this.rootStore.posts.fromFeedItem(item) + } const slices = this.tuner.tune(res.data.feed, this.feedTuners) @@ -405,6 +408,7 @@ export class PostsFeedModel { res: GetTimeline.Response | GetAuthorFeed.Response | GetCustomFeed.Response, ) { for (const item of res.data.feed) { + this.rootStore.posts.fromFeedItem(item) const existingSlice = this.slices.find(slice => slice.containsUri(item.post.uri), ) -- cgit 1.4.1