I noticed that there is a weird bug when using dset with mobx:
dset(data, "a.b.c", 1)
If data is an mobx observable (a deep and proxied one), dset will set only the first key a with an empty object.
The result will be:
{ a: {} }
instead of
{ a: { b: { c: 1 } } }
It happens only when using deep and proxy options in mobx (that are the default options).
Struggling with it, I found out that it is the multiple assignment used in dset function that breaks it.
It can be fixed splitting the multiple assignment into 2 different lines.
I noticed that there is a weird bug when using
dset
withmobx
:If
data
is an mobx observable (a deep and proxied one),dset
will set only the first keya
with an empty object. The result will be:instead of
It happens only when using deep and proxy options in mobx (that are the default options).
Struggling with it, I found out that it is the multiple assignment used in
dset
function that breaks it. It can be fixed splitting the multiple assignment into 2 different lines.I created a sandbox that shows everything I state here (fix included): https://codesandbox.io/s/dset-mobx-issue-x99gw