Form.Item dependencies don't work when a partial resetFields is triggered
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
Steps to reproduce
- Check hasName field to false.
- Click in “reset hasName” button
What is expected?
The name field should be re-mount when the hasName value changes. The disabled state of name field should be synchronized with hasName form value.
What is actually happening?
When form.resetFields(["hasName"])
is called, the name field render is not updated.
Environment | Info |
---|---|
antd | 4.16.6 |
React | 17.0.2 |
System | macOS Big Sur |
Browser | Google Chrome 91.0.4472.114 (Official Build) (x86_64) |
Note that with form.resetFields()
without params or changing the hasName value by radio field, the re-mount works.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to disable a field in Ant Design React Form?
I am using React with Ant Design and I want to disable one Form.Item username field. Please see my ...
Read more >Form - Ant Design
Does not work when multiple Item with same name setting the initialValue. Why does onFieldsChange trigger three times on change when field sets...
Read more >Form | ArcoDesign
A form with data collection, verification and submission functions, including checkboxes, radio buttons, input boxes, drop-down selection boxes and other ...
Read more >useFieldArray - Simple React forms validation
Custom hook for working with Field Arrays (dynamic form). The motivation is to provide better user ... Important: update data is required and...
Read more >React Hook Form - Reset form with default values and clear ...
Reset and form default values. Calling the reset function with an object (e.g. reset({ firstName: 'Bob' }) ) will also update the defaultValues ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This part of the issue has been fixed in the
v4.17.0
.It still doesn’t seem like the best solution, but it helps me because I can use
setFieldsValue
to change to the default value instead ofresetFields
.Similar issue #33068