Reproduction link
Steps to reproduce
增加一个list项,为Gender添加一个值,再为other,添加一个值,在改变Gender为other值,再为Customize Gender,添加一个值
What is expected?
输出的表单值只有gender和Customize Gender
What is actually happening?
输出的表单值只有gender和Customize Gender,还有other值
| Environment | Info |
| ------------ | ------------ |
| antd | 4.20.4 |
| React | ^16.14.0 |
| System | 无 |
| Browser | 无 |
在单纯的表单中使用,是正常的,只有在formList中使用就会发生这种情况
4条答案
按热度按时间cnwbcb6i1#
遇到同样问题,貌似还没修复
vshtjzan2#
In my case, when I added a new item, or remove (any actions);
shouldUpdate
still runs, but these values (preValue
, andcurrentValue
is the same) -> So, I try to change the approach, which allows me to getonChange
event in the list (add
,remove
) and customize it to an input box.You can try this solution:
Current state:
Change to:
When you handle
add
, orremove
an item from the list, run it withform.setFieldsValue
function to set a new value forlist0
.Yay, it works for me!
snvhrwxg3#
I also had the same problem
1u4esq0p4#
@afc163@MadCcc Is this issue still of concern?