Open ruscoder opened 7 years ago
I caught some problem when I tried to merge the following object with nested monkey:
tree = new Baobab({ a: 1, nested: [] }) tree.set(['nested', '0', 'dynamic'], Baobab.monkey(['a'], (a) => a + 1)); tree.merge({});
Result: Uncaught TypeError: Cannot set property dynamic of #<Object> which has only a getter(…)
Uncaught TypeError: Cannot set property dynamic of #<Object> which has only a getter(…)
But next example works as expected:
tree = new Baobab({ a: 1, nested: {} }) tree.set(['nested', 'dynamic'], Baobab.monkey(['a'], (a) => a + 1)); tree.merge({});
Hello @ruscoder. This is a bug I need to investigate indeed. However I see that in your example you seem to create monkeys in a path nested beneath an array. I would advise not to do this for performance reasons.
I caught some problem when I tried to merge the following object with nested monkey:
Result:
Uncaught TypeError: Cannot set property dynamic of #<Object> which has only a getter(…)
But next example works as expected: