about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-08-08 11:34:19 -0700
committerGitHub <noreply@github.com>2023-08-08 11:34:19 -0700
commit3c29a1be4d1bd9fb707cb05a8464ca7a094dd8e0 (patch)
tree9684c4a1c7e015d3cc40894c87fa2eeb7e651f54
parent872a7f93f4a2d1b0fe5050f85984f3b7d5215eae (diff)
downloadvoidsky-3c29a1be4d1bd9fb707cb05a8464ca7a094dd8e0.tar.zst
Fix to react-key uniqueness in feeds (#1136)
-rw-r--r--src/lib/api/feed-manip.ts6
-rw-r--r--src/state/models/feeds/posts-slice.ts2
2 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/api/feed-manip.ts b/src/lib/api/feed-manip.ts
index f4bf6cdff..d2bbb4e83 100644
--- a/src/lib/api/feed-manip.ts
+++ b/src/lib/api/feed-manip.ts
@@ -17,6 +17,12 @@ export class FeedViewPostsSlice {
 
   constructor(public items: FeedViewPost[] = []) {}
 
+  get _reactKey() {
+    return `slice-${this.rootItem.post.uri}-${
+      this.rootItem.reason?.indexedAt || this.rootItem.post.indexedAt
+    }`
+  }
+
   get uri() {
     if (this.isFlattenedReply) {
       return this.items[1].post.uri
diff --git a/src/state/models/feeds/posts-slice.ts b/src/state/models/feeds/posts-slice.ts
index d20c23b9c..16e4eef15 100644
--- a/src/state/models/feeds/posts-slice.ts
+++ b/src/state/models/feeds/posts-slice.ts
@@ -11,7 +11,7 @@ export class PostsFeedSliceModel {
   items: PostsFeedItemModel[] = []
 
   constructor(public rootStore: RootStoreModel, slice: FeedViewPostsSlice) {
-    this._reactKey = `slice-${slice.uri}`
+    this._reactKey = slice._reactKey
     for (let i = 0; i < slice.items.length; i++) {
       this.items.push(
         new PostsFeedItemModel(