foxhound87 / mobx-react-form

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

form.init() has a bug #561

Closed georgebbbb closed 2 years ago

georgebbbb commented 3 years ago

Hi, there,


import { Form } from "../../../../src";

const fields = ["qwerty"];

const values = { qwerty: ["a"] };

class NewForm extends Form {}

const form = new NewForm({ fields }, { name: "Fixes-A" });

form.init(values)

form.$("qwerty").set(["a", "b"]);

export default form;

and image

foxhound87 commented 3 years ago

please can you make a codesandbox with this issue?

foxhound87 commented 3 years ago

Yes, the init() method have still some issues. Actually, you should pass the values on the form constructor and use the update() method to change fields values after the form has been initialized.

foxhound87 commented 2 years ago

I think I'm going to deprecate init method in next releases

foxhound87 commented 2 years ago

the init() method has been deprecated in the next version