kettanaito / react-advanced-form

Functional reactive forms. Multi-layer validation, custom styling, field grouping, reactive props, and much more.
https://redd.gitbook.io/react-advanced-form
MIT License
217 stars 24 forks source link

handleFieldChange returns whatever controlled "onChange" returns as the next field state #359

Closed kettanaito closed 5 years ago

kettanaito commented 5 years ago

Environment

What

Current behavior

https://github.com/kettanaito/react-advanced-form/blob/9c17655af6add48eeb901f25b0350055f438e2bb/src/utils/handlers/handleFieldChange.js#L35-L47

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.

https://github.com/kettanaito/react-advanced-form/blob/9c17655af6add48eeb901f25b0350055f438e2bb/src/components/Form.jsx#L452-L454

This results into returned payload set as the field's state, which is wrong.

Expected behavior

How