Skip to content

Commit 489af5c

Browse files
committed
fix: useForm auto re-render the container
1 parent e9eab02 commit 489af5c

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/v2/hooks/useForm.ts

+3-11
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,8 @@ export const useForm = <TSchema>(props: ICreateFormProps<TSchema>) => {
1818
}
1919

2020
const latestState = useCallback(
21-
(state: IState) => {
22-
const latestState = _formState.current;
23-
24-
if (JSON.stringify(state.containerFormState) !== JSON.stringify(latestState)) {
25-
_formState.current = state.containerFormState;
26-
update();
27-
}
21+
() => {
22+
update();
2823
},
2924
[],
3025
);
@@ -36,7 +31,7 @@ export const useForm = <TSchema>(props: ICreateFormProps<TSchema>) => {
3631
});
3732

3833
useEffect(() => {
39-
latestState(_form.current.state);
34+
latestState();
4035
}, []);
4136

4237
useEffect(() => {
@@ -46,9 +41,6 @@ export const useForm = <TSchema>(props: ICreateFormProps<TSchema>) => {
4641
initialValues: props.initialValues,
4742
});
4843
update();
49-
50-
_form.current.notify("containers");
51-
_form.current.notify("fields");
5244
}, [props.schemas, props.extraData, props.initialValues]);
5345

5446
return {

0 commit comments

Comments
 (0)