Immutable.Record instances should not be boxed
Gozala opened this issue · comments
I have being running into a dropped missing unique "key" prop issue with Immutable.Record
instances as they are boxed, I have posted a comment in the relevant change:
6d8b850#commitcomment-10791363
I there a reason why Immutable instances are also boxed and not just cursors ?
Also regardless of type of the structure that omniscient boxes it should probably use a key from that structure otherwise it is impossible to render data structure of that type with a key.
Immutable instances are boxed to unwrap them as arguments when passed to the render-function but still work as expected inside the shouldComponentUpdate
.
You may have a point about using the key
from the structure which is passed. For now it only checks the argument key
or props.key
. If we were to extend this, we would have to do some "precedence checking". What if argument key
is set, and we have this:
if (_isCursor(props) || _isImmutable(props)) {
inputCursor = props;
_props = {};
_props[_hiddenCursorField] = inputCursor;
}
if (inputCursor && inputCursor.get('key')) {
key = inputCursor.get('key');
}
This would override key
, passed in as argument, but that should probably have higher precedence. So we would have to do
if (!key && inputCursor && inputCursor.get('key')) {
key = inputCursor.get('key');
}
But in this way we are starting to more and more couple to the Immutable.js implementation. _isCursor
and _isImmutable
are overridables, but inputCursor.get('key')
would be implementation specific.