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

useDynamicList 中使用resetList时,数据没有更新 #893

Closed
JSupot opened this issue Mar 17, 2021 · 1 comment · Fixed by #920
Closed

useDynamicList 中使用resetList时,数据没有更新 #893

JSupot opened this issue Mar 17, 2021 · 1 comment · Fixed by #920
Assignees

Comments

@JSupot
Copy link

JSupot commented Mar 17, 2021

在使用resetList时,对应的表单域中的数据没有变,源码中好像在reset的时候,重置了key,这里感觉应该在现有key的基础上进行递增,不然表单域中的key没有变,数据不会更新

@ttys026
Copy link
Collaborator

ttys026 commented Apr 22, 2021

你说的是对的,因为这个 hooks 开发的时间比较早, 当时配合 antd3 中 getFieldDecorator 不会有问题,因为 render props 的方式会强制重新渲染 children。这本来是 antd 的一个 bug,但是被当作 feature 在用。重置 key 反而可以让数组从 0 开始更具语义。

如果是配合 antd4 使用确实会导致无法重置内容的问题。修复 pr #920

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

Successfully merging a pull request may close this issue.

2 participants