@@ -132,7 +132,7 @@ module Make = (Config: Config) => {
132
132
validateField ,
133
133
state ,
134
134
}) => {
135
- handleChange : handleChange (field ),
135
+ handleChange : value => handleChange (field , value ),
136
136
error : getFieldError (Field (field )),
137
137
state : getFieldState (Field (field )),
138
138
validate : () => validateField (Field (field )),
@@ -159,17 +159,15 @@ module Make = (Config: Config) => {
159
159
) => {
160
160
let fieldInterface = useField (field )
161
161
162
- React .useMemo3 (
163
- () =>
164
- fieldInterface
165
- -> Belt .Option .map (render )
166
- -> Belt .Option .getWithDefault (renderOnMissingContext ),
167
- (
168
- fieldInterface -> Belt .Option .map (({error }) => error ),
169
- fieldInterface -> Belt .Option .map (({value }) => value ),
170
- fieldInterface -> Belt .Option .map (({state }) => state ),
171
- ),
172
- )
162
+ React .useMemo (() =>
163
+ fieldInterface
164
+ -> Belt .Option .map (render )
165
+ -> Belt .Option .getWithDefault (renderOnMissingContext )
166
+ , (
167
+ fieldInterface -> Belt .Option .map (({error }) => error ),
168
+ fieldInterface -> Belt .Option .map (({value }) => value ),
169
+ fieldInterface -> Belt .Option .map (({state }) => state ),
170
+ ))
173
171
}
174
172
}
175
173
@@ -183,12 +181,7 @@ module Make = (Config: Config) => {
183
181
(),
184
182
) => {
185
183
let (state , send ) = ReactUpdate .useReducer (
186
- {
187
- fieldsState : getInitialFieldsState (schema ),
188
- values : initialState ,
189
- formState : Pristine ,
190
- },
191
- (action , state ) =>
184
+ (state : state , action ) =>
192
185
switch action {
193
186
| Submit =>
194
187
UpdateWithSideEffects (
@@ -353,6 +346,11 @@ module Make = (Config: Config) => {
353
346
Update ({... state , values : Config .set (state .values , field , value )})
354
347
| RaiseSubmitFailed (err ) => Update ({... state , formState : SubmitFailed (err )})
355
348
},
349
+ {
350
+ fieldsState : getInitialFieldsState (schema ),
351
+ values : initialState ,
352
+ formState : Pristine ,
353
+ },
356
354
)
357
355
358
356
let getFieldState = field =>
@@ -365,12 +363,7 @@ module Make = (Config: Config) => {
365
363
let getFieldError = field =>
366
364
switch getFieldState (field ) {
367
365
| Error (error ) => Some (error )
368
- | NestedErrors (_errors ) =>
369
- Js .log2 (
370
- "The following field has nested errors, access these with `getNestedFieldError` instead of `getFieldError`" ,
371
- field ,
372
- )
373
- None
366
+ | NestedErrors (_errors ) => None
374
367
| Pristine
375
368
| Valid =>
376
369
None
0 commit comments