Closed lzfee0227 closed 2 years ago
It can be another question: in which cases should we dispose FormState
/ FieldState
?
https://mobx.js.org/best/pitfalls.html#always-dispose-reactions
It can be another question: in which cases should we dispose
FormState
/FieldState
?
case: use global store in validators? (will use autorun in formstate-x)
@nighca
case: use global store in validators?
And in the predict function of disableValidationWhen
.
With change of v3.x—as we stated in #40
https://github.com/qiniu/formstate-x/issues/18 will partly benefit from this: fields of array form state will always be correctly disposed as we manipulate them inside of formstate-x only.
We no longer need to worry about dispose
for child states. The remaining problem is: how to ensure the root state correctly disposed.
Actually it is almost the same problem as: how to ensure a MobX store correctly disposed.
Just like the latter one mostly solved with tools like useLocalStore
, the previous one can be mostly solved with tools like useFormstateX
Actually it is almost the same problem as: how to ensure a MobX store correctly disposed.
Since it turns out to be a problem not about formstate-x, but about MobX store. I will close this issue.
sth like:
or
https://github.com/mobxjs/mobx-react/issues/561
or sth else
FYI:
https://mobx.js.org/best/pitfalls.html#always-dispose-reactions