You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mergeIn throws Cannot read property 'merge' of null when mergeIn on keyPath that has a null value
An error is also thrown when a field is undefined, which makes more sense. To me, null is a placeholder and says "yes there will eventually be a value here" and that value can be anything. So why can't we merge into it?
It looks like mergeIn works on other values that aren't objects such as Bool/Nums etc. so it doesn't seem like this is intentional.
The error message is better in the latest 4.0.0-rc:
TypeError: Cannot merge into non-data-structure value: null
The mergeIn will try to merge at the path you specify, so you will try to merge null and Map({foo: 'bar'}), which is not possible because null can not be merged.
This is arguable thought, because it will work with an undefined value :
map1.mergeIn(['foo'],map2);// will output{
foo: {foo: "bar"}
nullField: null}
What happened
mergeIn throws
Cannot read property 'merge' of null
whenmergeIn
onkeyPath
that has a null valueAn error is also thrown when a field is
undefined
, which makes more sense. To me,null
is a placeholder and says "yes there will eventually be a value here" and that value can be anything. So why can't we merge into it?It looks like
mergeIn
works on other values that aren't objects such as Bool/Nums etc. so it doesn't seem like this is intentional.How to reproduce
https://codepen.io/vetrano89/pen/xxRGaJE
The text was updated successfully, but these errors were encountered: