Two fixes to react-key generation (#2004)

* Fix missing react keys in ListMembers

* Fix react key construction for the posts feed
zio/stable
Paul Frazee 2023-11-27 12:30:41 -08:00 committed by GitHub
parent 1dc017367e
commit cd43adf698
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -19,8 +19,9 @@ export class FeedViewPostsSlice {
constructor(public items: FeedViewPost[] = []) {} constructor(public items: FeedViewPost[] = []) {}
get _reactKey() { get _reactKey() {
return `slice-${this.items[0].post.uri}-${ const rootItem = this.isFlattenedReply ? this.items[1] : this.items[0]
this.items[0].reason?.indexedAt || this.items[0].post.indexedAt return `slice-${rootItem.post.uri}-${
rootItem.reason?.indexedAt || rootItem.post.indexedAt
}` }`
} }

View File

@ -215,7 +215,7 @@ export function ListMembers({
testID={testID ? `${testID}-flatlist` : undefined} testID={testID ? `${testID}-flatlist` : undefined}
ref={scrollElRef} ref={scrollElRef}
data={items} data={items}
keyExtractor={(item: any) => item.uri || item._reactKey} keyExtractor={(item: any) => item.subject?.did || item._reactKey}
renderItem={renderItem} renderItem={renderItem}
ListHeaderComponent={renderHeader} ListHeaderComponent={renderHeader}
ListFooterComponent={Footer} ListFooterComponent={Footer}