8000 [ v4 ] getIn throws deprecation warning when encountering null values. · Issue #1361 · immutable-js/immutable-js · GitHub
[go: up one dir, main page]

Skip to content
[ v4 ] getIn throws deprecation warning when encountering null values.  #1361
Closed
@Kyle-Mendes

Description

@Kyle-Mendes

What happened

Immutable v4 introduced a bug in getIn (and other methods as well, like hasIn) where attempting to continue on a list of keys after a null value was found would result in a deprecation warning. However, per discussion in #1161 this is not intended.

How to reproduce

const DB = Immutable.fromJS({ users: [{ name: 'Kyle', pets: null }] });

function getUserPet(userIndex, petIndex) {
  return DB.getIn(['users', userIndex, 'pets', petIndex, 'name'], 'no pet');
}

getUserPet(0,0); // throws warning -- Value at ["users",0,"pets"] does not have a .get() method: null

Expected although pets is null, the expected functionality would be that the getIn request will not throw a warning, but rather continue the v3 functionality.

See also: https://codepen.io/Pink401k/pen/NayNPp

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

      0