Skip to content

Commit

Permalink
Reuse objects to prevent re-renders
Browse files Browse the repository at this point in the history
  • Loading branch information
estrattonbailey committed Aug 2, 2024
1 parent 7d01503 commit 69fac75
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/view/com/lists/ProfileLists.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,7 @@ export const ProfileLists = React.forwardRef<SectionRef, ProfileListsProps>(
items = items.concat([EMPTY])
} else if (data?.pages) {
for (const page of data?.pages) {
items = items.concat(
page.lists.map(l => ({
...l,
_reactKey: l.uri,
})),
)
items = items.concat(page.lists)
}
}
if (isError && !isEmpty) {
Expand Down Expand Up @@ -192,7 +187,7 @@ export const ProfileLists = React.forwardRef<SectionRef, ProfileListsProps>(
testID={testID ? `${testID}-flatlist` : undefined}
ref={scrollElRef}
data={items}
keyExtractor={(item: any) => item._reactKey}
keyExtractor={(item: any) => item._reactKey || item.uri}
renderItem={renderItemInner}
refreshing={isPTRing}
onRefresh={onRefresh}
Expand Down

0 comments on commit 69fac75

Please sign in to comment.