Skip to content

Commit

Permalink
Merge pull request #5737 from WiXSL/fix-prop-override
Browse files Browse the repository at this point in the history
Fix getPossibleReferences.possibleValues prop being overriden
  • Loading branch information
djhi authored Jan 4, 2021
2 parents 44fd1d3 + bf4554c commit b1a6670
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/ra-core/src/reducer/admin/references/possibleValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,18 @@ export const getPossibleReferences = (
if (possibleValues.error) {
return possibleValues;
}
possibleValues = Array.from(possibleValues);
const possibleValuesList = Array.from(possibleValues);
selectedIds.forEach(
id =>
possibleValues.some(value => value === id) ||
possibleValues.unshift(id)
possibleValuesList.some(value => value === id) ||
possibleValuesList.unshift(id)
);
return (
possibleValuesList
// @ts-ignore
.map(id => referenceState.data[id])
.filter(r => typeof r !== 'undefined')
);
return possibleValues
.map(id => referenceState.data[id])
.filter(r => typeof r !== 'undefined');
};

export default possibleValuesreducer;

0 comments on commit b1a6670

Please sign in to comment.