File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -212,24 +212,26 @@ export function assignTempId(state, item) {
212
212
213
213
/**
214
214
* Get the id from a record in this order:
215
- * 1. id
216
- * 2. _id
217
- * 3. the `idField`
215
+ * 1. the `idField`
216
+ * 2. id
217
+ * 3. _id
218
218
* @param item
219
+ * @param idField
219
220
*/
220
221
export function getId ( item , idField ) {
221
222
if ( ! item ) {
222
223
return
223
224
}
225
+ if ( item [ idField ] != null || item . hasOwnProperty ( idField ) ) {
226
+ return item [ idField ]
227
+ }
224
228
if ( item . id != null || item . hasOwnProperty ( 'id' ) ) {
225
229
return item . id
226
230
}
227
231
if ( item . _id != null || item . hasOwnProperty ( '_id' ) ) {
228
232
return item . _id
229
233
}
230
- if ( item [ idField ] != null || item . hasOwnProperty ( idField ) ) {
231
- return item [ idField ]
232
- }
234
+
233
235
}
234
236
235
237
// Creates a Model class name from the last part of the servicePath
You can’t perform that action at this time.
0 commit comments