Commit d503b2c 1 parent 9941b41 commit d503b2c Copy full SHA for d503b2c
File tree 3 files changed +7
-7
lines changed
3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -20,13 +20,13 @@ export const useField = <TSchema extends ISchemaFieldCore>(props: {
20
20
const { form : formContext } = useContext ( FormContext ) ;
21
21
const { form = formContext , schema } = props as { form : IForm < TSchema > , schema : TSchema } ;
22
22
const _ref = useRef < any > ( ) ;
23
- const _state = useRef ( form . getSchemaFieldState < TSchema [ "initialValue" ] , TSchema [ "propStateType" ] & IDefaultProp > ( schema as any ) ) ;
23
+ const _state = useRef ( { } ) ;
24
24
const update = useUpdate ( ) ;
25
25
26
26
const latestState = useCallback (
27
27
( ) => {
28
28
const latestState = _state . current ;
29
- const state = form . getSchemaFieldState < TSchema [ "initialValue" ] , TSchema [ "propStateType" ] & IDefaultProp > ( schema as any ) ;
29
+ const state = form . getSchemaFieldState ( schema as any ) ;
30
30
if ( JSON . stringify ( state ) !== JSON . stringify ( latestState ) ) {
31
31
_state . current = state ;
32
32
update ( ) ;
@@ -53,7 +53,7 @@ export const useField = <TSchema extends ISchemaFieldCore>(props: {
53
53
} , [ schema . config . name ] ) ;
54
54
55
55
return {
56
- state : _state . current ,
56
+ state : form . getSchemaFieldState < TSchema [ "initialValue" ] , TSchema [ "propStateType" ] & IDefaultProp > ( schema as any ) ,
57
57
formState : form . state . containerFormState ,
58
58
ref : _ref ,
59
59
form,
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ export const useFieldArray = <TSchema extends ISchemaFieldCore>(props: {
69
69
} , [ schema . config . name ] ) ;
70
70
71
71
return {
72
- state : _state . current ,
72
+ state : form . getSchemaFieldState < TSchema [ "initialValue" ] , TSchema [ "propStateType" ] & IDefaultProp > ( schema as any ) ,
73
73
formState : form . state . containerFormState ,
74
74
ref : _ref ,
75
75
form,
Original file line number Diff line number Diff line change @@ -18,13 +18,13 @@ export const useView = <TSchema extends ISchemaCore>(props: {
18
18
} ) => {
19
19
const { form : formContext } = useContext ( FormContext ) ;
20
20
const { form = formContext , schema } = props as { form : IForm < TSchema > , schema : TSchema } ;
21
- const _state = useRef ( form . getSchemaViewState < TSchema [ "propStateType" ] & IDefaultProp > ( schema as any ) ) ;
21
+ const _state = useRef ( { } ) ;
22
22
const update = useUpdate ( ) ;
23
23
24
24
const latestState = useCallback (
25
25
( ) => {
26
26
const latestState = _state . current ;
27
- const state = form . getSchemaViewState < TSchema [ "propStateType" ] & IDefaultProp > ( schema as any ) ;
27
+ const state = form . getSchemaViewState ( schema as any ) ;
28
28
if ( JSON . stringify ( state ) !== JSON . stringify ( latestState ) ) {
29
29
_state . current = state ;
30
30
update ( ) ;
@@ -44,7 +44,7 @@ export const useView = <TSchema extends ISchemaCore>(props: {
44
44
} , [ schema ] ) ;
45
45
46
46
return {
47
- state : _state . current ,
47
+ state : form . getSchemaViewState < TSchema [ "propStateType" ] & IDefaultProp > ( schema as any ) ,
48
48
data : schema . config . data || { } ,
49
49
form,
50
50
} ;
You can’t perform that action at this time.
0 commit comments