ant-design / ant-design/pro-components

🧐[问题] ProForm 的 params 与 request 配合使用未根据返回内容刷新表单

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

### 🧐 问题描述

ProForm 的 params 与 request 配合使用未按返回内容重新更新表单字段。

![20240430154110_rec_-convert](https://github.com/ant-design/pro-components/assets/14144703/0f0a7d6f-ca64-413d-b99a-d868cc5cd4c3)

代码:
```TypeScript
import { ProForm, ProFormText } from '@ant-design/pro-components';

export default function TestBug({ id }: { id: number }) {
async function getById() {
const data = { content: `id:${id} now:${Date.now()}` };
console.log('TestBug: getById returns', data);
return data;
}
return (



);
}
```

只要相同 id 出现过,会调用 request,但不会刷新表单字段。
```TypeScript
const [id, setId] = useState(0);
setId((id) => id + 1);
setId((id) => id - 1);

```

完整代码:
https://stackblitz.com/edit/vitejs-vite-gfgb6m?file=src%2FApp.tsx

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the supplied TypeScript ProForm example or the linked StackBlitz, focusing on the interaction between params and request when an id value repeats. Done means the request response refreshes the form fields even after the same id has appeared before.

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.