Client store: replace updeep with immer
Currently, to keep the store immutable and to update it, we use updeep. However, this lib has several drawbacks:
- the API is not very clear/user frienldy (not to say awful to use with highly nested stores)
- the typing consistancy (to use with typescript) is not maintained with "complex" modifiers (ie the curried function ones).
- the object prototype is not maintained when modifying an object (meaning we need to call new Constructor(candidate) and maybe reattach the external data (ie transactions for an account) to keep the data synced.
I had a look to Immer (here: https://immerjs.github.io/) which fixes all the drawbacks identified here (even if the ugliness of an API is a matter of personal taste):
- modifying the state is as simple as modifying a plain object (https://immerjs.github.io/immer/docs/produce)
- the types are well infered with typescript (https://immerjs.github.io/immer/docs/typescript)
- it is possible to easily tell immer to keep the prototype of an object. (https://immerjs.github.io/immer/docs/complex-objects)
I also tested it, and works well (I did not see any problems from now). Implementation
Edited by Benjamin Bouvier