Closed
Description
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
Labels
No labels