about summary refs log tree commit diff
path: root/src/view
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-12-27 08:49:39 -0800
committerGitHub <noreply@github.com>2023-12-27 08:49:39 -0800
commit8b6ecf6bfff0a18e92a172004cd37fe2aacaf37f (patch)
tree4ee431b5c96c1cb3c9e02288b8ad48c2736d6a3a /src/view
parent0c9dc2163ab5102e58f13597ba84e14717e09ffd (diff)
downloadvoidsky-8b6ecf6bfff0a18e92a172004cd37fe2aacaf37f.tar.zst
Protect against react key duplicates (close #2278) (#2309)
* Fix duplicate react keys in post search

* Protect against duplicate react keys in feeds
Diffstat (limited to 'src/view')
-rw-r--r--src/view/screens/Search/Search.tsx5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/view/screens/Search/Search.tsx b/src/view/screens/Search/Search.tsx
index 60fd21674..b522edfba 100644
--- a/src/view/screens/Search/Search.tsx
+++ b/src/view/screens/Search/Search.tsx
@@ -212,12 +212,17 @@ function SearchScreenPostResults({query}: {query: string}) {
   const items = React.useMemo(() => {
     let temp: SearchResultSlice[] = []
 
+    const seenUris = new Set()
     for (const post of posts) {
+      if (seenUris.has(post.uri)) {
+        continue
+      }
       temp.push({
         type: 'post',
         key: post.uri,
         post,
       })
+      seenUris.add(post.uri)
     }
 
     if (isFetchingNextPage) {