ant-design / ant-design/pro-components

🐛[BUG]分步表单搭配Modal,使用Form.useForm(),在下一步有必填的选项时,无法到下一步

Open
#9,101 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

### 🐛 bug 描述

因为没有使用formRef,使用了Form.useForm()。
在后面的表单有必填项时 ,无法跳转下一步,控制台无报错,且onCurrentChange也无反应。
在使用普通的StepsForm或者后面的表单内没有必填项没有发生这种情况。

### 📷 复现步骤

[sandbox](https://codesandbox.io/p/sandbox/fen-bu-biao-dan-yu-modal-pei-he-shi-yong-forked-fr4lwz?file=%2FApp.tsx%3A63%2C13)

### 🚑 其他信息

相较于formRef,比较喜欢使用Form.useForm()。所以发现了问题,不知道是什么原因导致的,难不成需要使用formRef而不能使用Form.useForm()吗?

Contributor guide

Open the contributing guide

Research direction

Start with the linked CodeSandbox and inspect App.tsx around line 63,13, focusing on the Modal, StepsForm, and Form.useForm() setup. Reproduce the case where a later step has required fields, then trace why advancing does not trigger onCurrentChange; done means the next step can be reached while required-field validation still works.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.