Skip to content

Commit

Permalink
fix(uniqIds): Removed the bug that made able uniqIds to contain undef…
Browse files Browse the repository at this point in the history
…ined
  • Loading branch information
Luc Merceron committed Sep 18, 2017
1 parent 9874309 commit d123a0d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/referenceFetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ const registerNewEntity = (entity, id, value = true) => {
const retrieveUniquesIds = (parent, relation, optional = false) =>
parent.reduce((acc, object) => {
const { [relation]: relationId } = object

if (!relationId && !optional) {
warning(`the relation ${relation} could not be found in object ${object.id}`, true)
} else if (acc.indexOf(relationId) === -1) {
} else if (acc.indexOf(relationId) === -1 && typeof relationId !== 'undefined') {
// Keep the list unique
acc.push(relationId)
}
Expand Down

0 comments on commit d123a0d

Please sign in to comment.