Skip to content

Nested objects diff incorrectly #18

@netogallo

Description

@netogallo

If a record (probably other elements) contains a plain JSON object wich needs a replace operation, it will be replaced by a Immutable map.

const R = Record({test: {wrong: false}})
var patch = diff(R(), R({test: {wrong: true}})
console.log(patch.getIn([0,"value"]).wrong) // prints undefined instead of true

This happens because after computing the patch, Immutable.fromJS() is called which interprets the plain objects as immutable maps. The fix is simple and I can send you a pull request. I was just wondering if this was intentional or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions