-
-
Notifications
You must be signed in to change notification settings - Fork 54.6k
动态规则rules为空时,已校验出的错误无法被消除 #51008
Copy link
Copy link
Open
react-component/field-form
#729Labels
Inactivehelp wantedThe suggestion or request has been accepted, we need you to help us by sending a pull request.The suggestion or request has been accepted, we need you to help us by sending a pull request.
Metadata
Metadata
Assignees
Labels
Inactivehelp wantedThe suggestion or request has been accepted, we need you to help us by sending a pull request.The suggestion or request has been accepted, we need you to help us by sending a pull request.
Reproduction link
https://codesandbox.io/p/sandbox/antd-reproduction-template-forked-sr3vgc?workspaceId=f8c8b8be-9c36-4d85-adcf-c7766abab738
Steps to reproduce
What is expected?
当rules为空数组时,能正确的将错误信息去掉
What is actually happening?
当rules为空数组时,无法移除已经校验的错误信息
经过断点排查发现这个错误来自rc-form-field/src/useForm.ts#904 当rule为空时,无法不再触发校验逻辑。 代码如下
目前的临时解决方案