handleFieldChange returns whatever controlled "onChange" returns as the next field state
kettanaito opened this issue · 0 comments
kettanaito commented
Environment
- react-advanaced-form: 1.6.5
What
Current behavior
react-advanced-form/src/utils/handlers/handleFieldChange.js
Lines 35 to 47 in 9c17655
This returns anything controlled change handler returns (i.e. async action). Later, depending on the returned payload from the handleFieldChange
handler, Form.handleFieldChange
dispatches its updateFieldWith
.
react-advanced-form/src/components/Form.jsx
Lines 452 to 454 in 9c17655
This results into returned payload set as the field's state, which is wrong.
Expected behavior
- Only valid field state is set in the field's state
How
- Dispatch the
onChange
handler first, then return short-circuit