Closed ianp closed 9 years ago
FWIW a simpler example based on the one from your docs seems to do the right thing for me:
Immutable({all: "your base", are: {belong: "to them"}}).merge({are: {belong: "to us"}}).merge({all: "the world"})
produces:
{all: "the world", are: { belong: "to us"} }
@ianp: If you want to do a deep merge then the second argument shouldn't be true
, it should be {deep: true}
like:
obj.merge({streams: {a: { loading: true }}}, {deep: true});
It produces the desired results:
{
streams: {
a: {name: 'Conversations', channel: [Object], loading: true},
b: {name: '@Mentions', channel: [Object], loading: false},
c: {name: 'Facebook', channel: [Object], loading: false}
},
streamOrder: ['c', 'a', 'b']
}
Right you are, told you it was probably me doing something daft! Thanks!
Unless I'm doing something daft (always a strong possibility!). Given
then running
j.merge({streams: {a: { loading: true }}}, true)
producesso instead of doing a deep merge it has thrown away all of the data under the
streams
key! Have I misunderstood how the deep merge is meant to work?It's also converted the data under streamOder from an Array to an Object, but I can live with that for the time being :-)