Getters getting triggered on n-dimensional maps
Seems like the refactor of reactor now triggers getters whenever a change happens at the root level.
For ex:
export default {
getter: [['key1', 'key2', 'key3'], item => item]
}
version 1.1.2 and before, will only get triggered when ['key1', 'key2', 'key3'] has changed.
version 1.2.0 the above getter is triggered when anything in ['key1'] changes. This is undesirable as even if key3 has not been set it will still receive and update a bound state with undefined.
Hey Pbeets,
Under the hood the getter evaluation mechanism has changed, however it shouldn't be calling a change handler (via observe) unless the value of the getter has changed?
Can you elaborate a bit more on how you are consuming this getter, are you evaluate or observe or using ReactMixin?
This seems like a pretty serious issue to me, it'd be great to have more context.
@jordangarcia I'm consuming it via getDatabindings / ReactMixin. However using an observe seems to have the same effect.
The getters are setup before hand so the data it's supposed to get doesn't exist yet.
What type of data is being returned, you mentioned that it was undefined?
If you could post an example of the store / getter that would help a lot
On Wednesday, November 4, 2015, pbeets [email protected] wrote:
@jordangarcia https://github.com/jordangarcia I'm consuming it via getDatabindings / ReactMixin. However using an observe seems to have the same effect.
— Reply to this email directly or view it on GitHub https://github.com/optimizely/nuclear-js/issues/187#issuecomment-153830646 .
Unable to reproduce. Looks like it was a problem on my end.
@jordangarcia Alright, finally figured out the condition. Looks like for particular set of combine functions, the getter handler is being called regardless.
I've added an example: https://gist.github.com/pbeets/2682c0fb5b8243c165a1