var obj = mobx.observable({ arr: [{}, {}, {}] });
mobx.reaction(() => obj.arr.map(x => x.foo), (newValue) => {
console.log(newValue);
});
var trigger = mobx.observable({ flag: false });
mobx.reaction(() => trigger.flag, newValue => {
obj.arr.forEach((x, i) => { x.foo = 'bar'; });
});
trigger.flag = true;
vs
var obj = mobx.observable({ arr: [{}, {}, {}] });
mobx.reaction(() => obj.arr.map(x => x.foo), (newValue) => {
console.log(newValue);
});
obj.arr.forEach((x, i) => { x.foo = 'bar'; });
Please consider two pieces of code at above. 1st trigger the side effect with console.log(newValue);
once only. Which I expected to be fired 3 times like how the 2nd example works.
Is this a bug? or by design?