-
-
Notifications
You must be signed in to change notification settings - Fork 53.1k
Closed
Description
- I have searched the issues of this repository and believe that this is not a duplicate.To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Reproduction link
Steps to reproduce
1.为Table指定column和rowKey;
2.特意写几条rowKey相同的数据存放至dataSource;
3.使用this.setState改变dataSource;
4.发现rowKey相同的数据还存在表格中,只有最后一个rowKey相同的数据被干掉了(张六那条数据);
What is expected?
1.dataSource已经被重新赋值,应当展示重新赋值后的数据;
What is actually happening?
原来id重复的数据,不会被丢弃,dataSource中其实并不存在了
Environment | Info |
---|---|
antd | 3.14.1 |
React | 16.8.3 |
System | windows 10 |
Browser | Chrome 72.0 |
这大约不算bug,讲道理,rowKey的要求就是非重复的,然而在实际业务中,偶尔会有数据出现重复的情况,这个点,颇为无奈
目前的馊招:
1.去掉rowKey,不指定rowKey,只是页面会抛错误,但是实际上并不影响使用.....2333
2.进行数组的去重比较(但是因为业务方面的问题,又得跟后台的小伙伴扯皮了...)
最后一个rowKey相同的数据会正确的丢掉,所以,是循环的时候出了问题???
Activity
yesmeck commentedon Mar 7, 2019
确实不算 bug,
key
必须唯一,React 的规矩我们也没什么好做的。hygxmm commentedon Jun 27, 2023
对数据进行排序,两次返回的数据有相同的,dataSource里面数据正常,table会渲染两条一样的数据