ant-design / ant-design/pro-components

🐛[BUG] StepsForm.StepForm中的request请求一开始就全部执行了,需要在点击下一步进入第二步StepForm才请求数据

Open
#8,231 0 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

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

### 🐛 bug 描述
分步表单,分成两步骤,第二步依赖第一步的选择结果,异步请求数据。当前在第一步时,第二步的request就执行了。

### 🏞 期望结果

进入当前步骤时StepForm才开始请求

### 💻 复现代码

import {
PageContainer,
ProFormSelect,
StepsForm,
} from '@ant-design/pro-components';
import type { FormInstance } from 'antd';
import { Card} from 'antd';
import React, { useRef, useState } from 'react';
import type { StepDataType } from './data.d';

const StepForm: React.FC> = () => {
const [current, setCurrent] = useState(0);
const formRef = useRef();
return (




formRef={formRef}
title="填写转账信息"
>

{
console.log('第二步请求')
return Promise.resolve();
}}>




);
};
export default StepForm;
image

### © 版本信息

- ProComponents 版本: "@ant-design/pro-components": "^2.6.44",
- umi 版本: "@umijs/max": "^4.1.0",
- 浏览器环境: chrome
- 开发环境: mac

### 🚑 其他信息
直接官网拉的模版,不知道这算是featrue还是bug,希望得到解决方案。

Contributor guide

Open the contributing guide

Research direction

Start with the StepsForm.StepForm request handling shown in the reproduction and run the two-step example to confirm that the second step logs its request while the first step is displayed. Trace when the second step becomes active; done means its request runs only upon entering that step and still receives the first step's selection as needed.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.