Skip to content

4.0rc2 getIn() not handling nulls gracefully on Records #1161

Closed
@EvHaus

Description

@EvHaus

What happened

After upgrading from 3.x to 4.x the getIn() method is not behaving as before and not as documented. It often returns Invalid keyPath: Value at ["someKey"] does not have a .get() method: null instead of handling null keys gracefully.

How to reproduce

const ABRecord = Immutable.Record({ a: 1})
const myRecord = new ABRecord()
console.log(myRecord.getIn(['a', 'b']));

Returns

TypeError: Invalid keyPath: Value at ["a"] does not have a .get() method: 1

But I expected it to return null instead.

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