Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List component is changing the Item key after refresh. #12298

Closed
1 task done
douglasjunior opened this issue Sep 18, 2018 · 1 comment
Closed
1 task done

List component is changing the Item key after refresh. #12298

douglasjunior opened this issue Sep 18, 2018 · 1 comment

Comments

@douglasjunior
Copy link
Contributor

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.9.2

Environment

MacOSX 10.13.6, Opera 55.0.2994.61, React 16.3.2

Reproduction link

https://github.com/ant-design/ant-design/blob/master/components/list/index.tsx

Steps to reproduce

Simple use the List component with several itens.

What is expected?

I expect the Items keys to be the one returned by the rowKey function.

What is actually happening?

The List component use the React.Children.map to clone the Itens. But the React.Children.map adds a prefix to the keys of the each Item, causing a forced refresh.


The bug is in this line

const childrenList = React.Children.map(items, (child: any, index) =>
React.cloneElement(child, {
key: this.keys[index],
}),
);

Example:

image

@douglasjunior
Copy link
Contributor Author

If possible, I can fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants