8000 Form.List 中,使用 noStyle 管理异常信息显示位置时,增删选项导致错误信息错位以及不更新。 · Issue #54119 · ant-design/ant-design · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Form.List 中,使用 noStyle 管理异常信息显示位置时,增删选项导致错误信息错位以及不更新。 #54119
Open
@besidewind

Description

@besidewind

Reproduction link

Edit on CodeSandbox

Steps to reproduce

在官网 deom https://ant.design/components/form-cn#form-demo-dynamic-form-items 的基础上添加了 rules 做必填校验。
在重现链接中

  1. 点击 Add Item
  2. 在两个 Card 中分别点击 Add Sub Item
  3. 点击 submit 出现校验错误提示
  4. 删除第一个 Card
  5. 点击 submit,此时 Sub Item 部分出现重复的校验错误提示

What is expected?

第 5 步操作时,只出现 'items.0.list.0.first' is required 提示
Image

What is actually happening?

第 5 步点击 submit 后出现提示:

'items.1.list.0.first' is required
'items.0.list.0.first' is required
Image
Environment Info
antd 5.26.1
React React 18.0.0
System MacOS
Browser chrome 137.0.7151.104

之后填写 first 字段,'items.1.list.0.first' is required 会消失,'items.0.list.0.first' is required 则会一直显示,但是并不会导致 form.validateFields 失败。
在我的具体的业务代码里去掉 noStyle 就没有此问题,基本可以确定和 noStyle 有关。

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 BugAnt Design Team had proved that this is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0