Skip to content

Commit

Permalink
refactor: simplify component
Browse files Browse the repository at this point in the history
  • Loading branch information
raviteja83 committed Oct 4, 2023
1 parent b2f7974 commit 49e337e
Showing 1 changed file with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,14 @@ const VirtualizedParticipantItem = React.memo(
({
index,
data,
hasNext,
loadMore,
style,
}: {
index: number;
data: ItemData;
hasNext: boolean;
loadMore: () => Promise<void>;
data: ItemData & { hasNext: boolean; loadMorePeers: () => Promise<void> };
style: React.CSSProperties;
}) => {
if (!data.peerList[index]) {
return <LoadMoreParticipants hasNext={hasNext} loadMore={loadMore} style={style} />;
return <LoadMoreParticipants hasNext={data.hasNext} loadMore={data.loadMorePeers} style={style} />;
}
return (
<Participant
Expand Down Expand Up @@ -115,21 +111,13 @@ export const PaginatedParticipants = ({ roleName, onBack }: { roleName: string;
<Box css={{ flex: '1 1 0', overflowY: 'auto', overflowX: 'hidden', mr: '-$10' }}>
<VariableSizeList
itemSize={index => (index === filteredPeers.length + 1 ? 16 : ROW_HEIGHT)}
itemData={{ peerList: filteredPeers, isConnected: isConnected === true }}
itemData={{ peerList: filteredPeers, hasNext, loadMorePeers, isConnected: isConnected === true }}
itemKey={itemKey}
itemCount={filteredPeers.length + 1}
width={width}
height={height}
>
{({ index, data, style }) => (
<VirtualizedParticipantItem
index={index}
data={data}
style={style}
hasNext={hasNext}
loadMore={loadMorePeers}
/>
)}
{VirtualizedParticipantItem}
</VariableSizeList>
</Box>
</Flex>
Expand Down

0 comments on commit 49e337e

Please sign in to comment.