omniscientjs / immstruct

Immutable data structures with history for top-to-bottom properties in component based libraries like React. Based on Immutable.js
374 stars 21 forks source link

correctly traverse immutable collection and non-immutable collection by key #78

Closed dashed closed 9 years ago

dashed commented 9 years ago

when traversing a non-immutable collection by key, set it as void 0.

mikaelbr commented 9 years ago

See https://github.com/omniscientjs/immstruct/commit/e1d2488c3d0791fc212494beffcf3601b67d8443#commitcomment-11868738

Yeah, but I think that as you listen to change on ['foo', 'value'] and with the first change on foo it should trigger the listener twice. as a change on foo (as a parent of value) is essentially a change in value as well.

dashed commented 9 years ago

Ah didn't see that comment. I added my arguments https://github.com/omniscientjs/immstruct/commit/e1d2488c3d0791fc212494beffcf3601b67d8443#commitcomment-11868738

mikaelbr commented 9 years ago

Thinking about this in terms of for instance "sub render-loops" in React, I think you are right. Say I have a component that listens to ['foo', 'value'] and value is unchanged, I wouldn't expect to get triggered. The output is still the same (undefined). Good catch, @Dashed