Closed tomalec closed 5 years ago
We can argue, that JS object with setter is not a JSON, therefore, we should not compromise performance for non-standard object.
React Easy State does not make this sacrifice.
See "Avoid using the this keyword in the methods of your state stores."
It was discussed on a HO between me and @tomalec that we should introduce 2 modes of operation in JSONPatcherProxy:
tree[key] = newValue
.I can volunteer to do this change, but only if PR #42 is accepted first. Otherwise I would go nuts with the tests :)
This PR was rebased on current master
and is now available as a new PR #44
For example, to be able to observe the change made to
obj.foo
by settingobj.bar='new'
Before this PR,
this
in setter was referring to original object not the proxy.This change decreases performance significantly. According to
npm run bench
executed 3 times on my local it's: