Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge and monkey issue #465

Open
ruscoder opened this issue Dec 9, 2016 · 1 comment
Open

Merge and monkey issue #465

ruscoder opened this issue Dec 9, 2016 · 1 comment
Labels

Comments

@ruscoder
Copy link

ruscoder commented Dec 9, 2016

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(…)

But next example works as expected:

tree = new Baobab({ a: 1, nested: {} })
tree.set(['nested', 'dynamic'], Baobab.monkey(['a'], (a) => a + 1));
tree.merge({});
@Yomguithereal
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants