Skip to content

[ v4 ] getIn throws deprecation warning when encountering null values. #1361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Kyle-Mendes opened this issue Oct 6, 2017 · 0 comments
Closed

Comments

@Kyle-Mendes
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant