Open
Description
Description
If I have a record in cache with valid properites, and later on if its gets 'merged with another version of this record that has some of the properties 'undefined
, valid properties present in cache earlier gets over-written with 'undefined' values in deepMixIn()
function.
Here is current implementation of this function:
deepMixIn: function deepMixIn(dest, source) {
if (source) {
for (var key in source) {
var value = source[key];
var existing = dest[key];
if (isPlainObject(value) && isPlainObject(existing)) {
utils.deepMixIn(existing, value);
} else {
dest[key] = value;
}
}
}
return dest;
},
And we can fix it by changing it like:
deepMixIn: function deepMixIn(dest, source) {
if (source) {
for (var key in source) {
var value = source[key];
var existing = dest[key];
if (isPlainObject(value) && isPlainObject(existing)) {
utils.deepMixIn(existing, value);
} else if (typeof value !== 'undefined') {
dest[key] = value;
}
}
}
return dest;
},
Environment
- js-data version:
"js-data": "^3.0.5",
"js-data-http": "^3.0.1", - node or browser version: v10.7.0
- operating system: macOS
Thanks!
Metadata
Metadata
Assignees
Labels
No labels