Skip to content

Commit

Permalink
feat: remove old key
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyair committed Nov 8, 2022
1 parent 6a6ac57 commit 641fe38
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions components/list/index.tsx
Expand Up @@ -104,8 +104,6 @@ function List<T>({
total: 0,
};

const listItemsKeys: { [index: number]: React.Key } = {};

const triggerPaginationEvent = (eventName: string) => (page: number, pageSize: number) => {
setPaginationCurrent(page);
setPaginationSize(pageSize);
Expand Down Expand Up @@ -135,8 +133,6 @@ function List<T>({
key = `list-item-${index}`;
}

listItemsKeys[index] = key;

return <React.Fragment key={key}>{renderItem(item, index)}</React.Fragment>;
};

Expand Down Expand Up @@ -249,8 +245,8 @@ function List<T>({
let childrenContent = isLoading && <div style={{ minHeight: 53 }} />;
if (splitDataSource.length > 0) {
const items = splitDataSource.map((item: T, index: number) => renderInnerItem(item, index));
const childrenList = React.Children.map(items, (child: React.ReactNode, index: number) => (
<div key={listItemsKeys[index]} style={colStyle}>
const childrenList = React.Children.map(items, child => (
<div key={child?.key} style={colStyle}>
{child}
</div>
));
Expand Down

0 comments on commit 641fe38

Please sign in to comment.