Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复表单重置后,页面变化了,表单内部的状态未能及时同步 #3882

Merged
merged 1 commit into from
May 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/components/Form/src/hooks/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,13 @@ export function useForm(props?: Props): UseFormReturnType {
form.clearValidate(name);
},

resetFields: async () => {
getForm().then(async (form) => {
await form.resetFields();
resetFields: () => {
// 修复表单重置后,页面变化了,但是由于异步问题导致表单内部的状态没有及时同步
return new Promise((resolve) => {
getForm().then(async (form) => {
await form.resetFields();
resolve();
});
});
},

Expand Down
Loading