Skip to content

Commit

Permalink
fix: change FormList initialValues apply logic
Browse files Browse the repository at this point in the history
  • Loading branch information
wanpan11 committed Mar 18, 2024
1 parent 29e1b06 commit a5888dd
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/components/FormList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface FormFilterProps {

/**
*
* @description itemInfo change component will rerender
* @description extend antd Form
*/
const FormList = ({
style,
Expand All @@ -36,6 +36,7 @@ const FormList = ({
labelCol,
wrapperCol,
initialValues,

onOk,
onForm,
onValuesChange,
Expand All @@ -47,6 +48,8 @@ const FormList = ({
};

useEffect(() => {
onForm && onForm(form);

if (initialValues) {
form.setFieldsValue(initialValues);
} else {
Expand All @@ -57,12 +60,6 @@ const FormList = ({
});
}

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [itemInfo, form]);

useEffect(() => {
onForm && onForm(form);

// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

Expand Down

0 comments on commit a5888dd

Please sign in to comment.