ant-design / ant-design/pro-components
🐛[BUG] ProForm的validteFileldsReturnFormatValue方法在执行前进行状态变量更新的话导致表单检验未执行
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 1.4k
- Avg merge
- 10h 44m
- Merged PRs (30d)
- 3
Description
### 🐛 bug 描述
在执行formRef.current.validteFileldsReturnFormatValue()前,我添加了一个状态变量修改函数setLoading(true),然而会导致表单未进行必填校验,直接执行validteFileldsReturnFormatValue的then
### 💻 复现代码
`const submit =() = >{
setLoading(true); // 这里set的话会使表单校验失效
formRef.current.validteFileldsReturnFormatValue()
.then(res=>{
// 业务操作
}).finnally(()=>{
setLoading(true);
});
}`
### © 版本信息
- ProComponents 版本: 2.6.44
- umi 版本 4.0.35
- 浏览器环境 120.0.6099.225
- 开发环境 PC
Contributor guide
Research direction
Start at the ProForm implementation of validteFileldsReturnFormatValue and reproduce the example with setLoading(true) before the call. Check the form-validation path and its related tests, if present; done means required-field validation still runs and the returned promise reflects the validation result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100