Fix bug with checking for `id` field
The getId
utility function has been updated to check the prototype chain for the id
property.
/**
* Get the id from a record in this order:
* 1. id
* 2. _id
* 3. the `idField`
* @param item
*/
export function getId(item, idField) {
if (!item) {
return
}
if (item.id != null || item.hasOwnProperty('id')) {
return item.id
}
if (item._id != null || item.hasOwnProperty('_id')) {
return item._id
}
if (item[idField] != null || item.hasOwnProperty(idField)) {
return item[idField]
}
}