Closed tnrich closed 8 years ago
@Yomguithereal I have the same issue as @tnrich. Any Monkey that is not at the root the of the state tree results in the above error.
Hello @tnrich and @abalmos. Can you tell me if you are able to reproduce the bug with raw Baobab outside of the cerebral Model please?
I get the bug and we are only using React and Baobab, so it's not a Cerebral issue.
Ok. Can you show me the use case @Zache? Or does the one shown at the beginning at this issue, without cerebral decorum work?
@Yomguithereal I'm working on making an isolated repro, but it's not cooperating with me right now :cry:
var Baobab = require('baobab');
var Monkey = Baobab.monkey;
var baobab = new Baobab({
blubb: {
data: {
name: 'zacharias',
primes: [2, 3, 5, 7, 11],
doubler: Monkey(['.', 'primes'], primes => primes.map(n => n * 2))
},
other: {
trippler: Monkey(['..', 'data', 'primes'], n => n * 3)
}
}
});
baobab.merge(['blubb'], { data: { stuff: 13, primes: [2, 3, 5, 7] } });
Thanks @Zache. I will look into it.
Version 2.3.2
is now released.
@Yomguithereal Thanks for quick response! However, it seems that with 2.3.2
the trippler
monkey function is called twice. Once with the new array of primes and once with undefined
(which of course breaks the monkey).
Here is the updated example case:
var Baobab = require('baobab');
var Monkey = Baobab.monkey;
var baobab = new Baobab({
blubb: {
data: {
name: 'zacharias',
primes: [2, 3, 5, 7, 11],
doubler: Monkey(['.', 'primes'], primes => primes.map(n => n * 2))
},
other: {
trippler: Monkey(['..', 'data', 'primes'], n => n.map(n * 3))
}
}
});
baobab.merge(['blubb'], { data: { stuff: 13, primes: [2, 3, 5, 7] } });
baobab.get(['blubb', 'other', 'trippler']);
Hey @Yomguithereal , this one is a little bit tricky and might be hard to debug. I haven't yet been able to produce a simplified test-case for it, but at least it is reproducible within the repo I'm in.
Here's the code that produces the bug:
When the first comment block is commented in, no error occurs, everything just runs as it should. However, if the second comment block is commented in, I'm getting this error:
As you can see, the error is getting triggered by the cerebral devtools.
Let me know what other info/setup I can provide you with to help you out.
Thanks!