foxhound87 / mobx-react-form

Reactive MobX Form State Management
https://foxhound87.github.io/mobx-react-form
MIT License
1.09k stars 129 forks source link

Invalid form instance when extending DVR validator #579

Open Nodios opened 3 years ago

Nodios commented 3 years ago

If you have multiple forms instantiated, custom DVR rules registered, and if you pass in form instance to the rules, once validation kicks in, rules will receive invalid form instance. E.g. they will receive the instance of form that was last instantitated.

Reproduction: https://stackblitz.com/edit/react-ybjhpf

See rules.js and inspect "form" property values.

foxhound87 commented 1 year ago

This is related to validatorjs. When you register new rules you are actually overriding the rule using the second form instance. I dont't know if this can be fixed due to the validatorjs lib limitation.