intelie / immutable-js-diff

MIT License
261 stars 32 forks source link

Record #15

Closed arieldf closed 7 years ago

arieldf commented 7 years ago

Using immutable records seems not to be supported, or am I wrong?

pedroteixeira commented 7 years ago

It should work, but I haven't tested.

Just checked that there is currently a check isMap that uses Immutable.Iterable.isKeyed and Records should pass that:

var A = Immutable.Record({a:null})
Immutable.Iterable.isKeyed(new A({}))
> true

Please, feel free to improve this library submiting tests or patches!

pedroteixeira commented 7 years ago

Just checked, and it seems to work fine:

require('immutablediff')(new A({a:2}),  new A({a:3})).toJS()
[{"op":"replace","path":"/a","value":3}]
arieldf commented 7 years ago

@pedroteixeira I am using Immutable 4.0.0rc2 and this is not working. I will investigate - basically it replaces the whole structure

pedroteixeira commented 7 years ago

hmm. thanks, I was testing with 3.7.x - will try to have a look as well as soon as I can (prob. next week). feel free to submit patches or suggestions!

arieldf commented 7 years ago

I will @pedroteixeira. isKeyed is moved from Iterable to Collection in 4.0 and that is definitely a breaking change.