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

FormProvider: "rules" updates passed via context do not update "Form.state.rules" #362

Closed kettanaito closed 5 years ago

kettanaito commented 5 years ago

Environment

What

Current behavior

The updates of FormProvider.props.rules is never reflected in the Form.state.rules, and it may contain obsolete values.

Expected behavior

Value updates in FormProvider.props.rules is reflected properly in Form.state.rules.

Why

https://github.com/kettanaito/react-advanced-form/blob/75862b77c9778e29bd87bd6edb6596c5142a3caf/src/components/Form.jsx#L145

Compares prev and next props, while rules may also come from FormProvider context.

How

Need to check if the context rules have changed, and if they had, update the state.

kettanaito commented 5 years ago

Published under ba1aa4d742a189ba8e7207f9a089dc6180355f1d.