Protect against react key duplicates (close #2278) (#2309)

* Fix duplicate react keys in post search

* Protect against duplicate react keys in feeds
This commit is contained in:
Paul Frazee 2023-12-27 08:49:39 -08:00 committed by GitHub
parent 0c9dc2163a
commit 8b6ecf6bff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 9 deletions

View file

@ -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) {