From 8af8d782c71de90a719e661abe6bc496b8f27be5 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 13 Dec 2022 15:17:18 -0600 Subject: Fix issue that caused repost & trend data to get lost on feed updates --- src/state/models/feed-view.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/state/models/feed-view.ts b/src/state/models/feed-view.ts index 6a23654fd..18b3e4c1a 100644 --- a/src/state/models/feed-view.ts +++ b/src/state/models/feed-view.ts @@ -520,10 +520,11 @@ export class FeedModel { private _updateAll(res: GetTimeline.Response | GetAuthorFeed.Response) { for (const item of res.data.feed) { const existingItem = this.feed.find( - // this find function has a key subtley- the indexedAt comparison - // the reason for this is reposts: they set the URI of the original post, not of the repost record - // the indexedAt time will be for the repost however, so we use that to help us - item2 => item.uri === item2.uri && item.indexedAt === item2.indexedAt, + // HACK: need to find the reposts and trends item, so we have to check for that -prf + item2 => + item.uri === item2.uri && + item.repostedBy?.did === item2.repostedBy?.did && + item.trendedBy?.did === item2.trendedBy?.did, ) if (existingItem) { existingItem.copy(item) -- cgit 1.4.1