Skip to content

Commit c165201

Browse files
committed
indexByKey should prefer first dataObject
1 parent 6fddc49 commit c165201

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/shared/static.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,9 @@ const parseIntWithFallback = (input, fallback) => {
378378
const indexByKey = (dataObjects, key) =>
379379
dataObjects.reduce((result, dataObject) => {
380380
const identifier = dataObject[key];
381-
result[identifier] = dataObject;
381+
if (!Object.prototype.hasOwnProperty.call(result, identifier)) {
382+
result[identifier] = dataObject;
383+
}
382384
return result;
383385
}, {});
384386

0 commit comments

Comments
 (0)