Skip to content

Commit b1a6670

Browse files
authored
Merge pull request #5737 from WiXSL/fix-prop-override
Fix getPossibleReferences.possibleValues prop being overriden
2 parents 44fd1d3 + bf4554c commit b1a6670

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

packages/ra-core/src/reducer/admin/references/possibleValues.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,18 @@ export const getPossibleReferences = (
5656
if (possibleValues.error) {
5757
return possibleValues;
5858
}
59-
possibleValues = Array.from(possibleValues);
59+
const possibleValuesList = Array.from(possibleValues);
6060
selectedIds.forEach(
6161
id =>
62-
possibleValues.some(value => value === id) ||
63-
possibleValues.unshift(id)
62+
possibleValuesList.some(value => value === id) ||
63+
possibleValuesList.unshift(id)
64+
);
65+
return (
66+
possibleValuesList
67+
// @ts-ignore
68+
.map(id => referenceState.data[id])
69+
.filter(r => typeof r !== 'undefined')
6470
);
65-
return possibleValues
66-
.map(id => referenceState.data[id])
67-
.filter(r => typeof r !== 'undefined');
6871
};
6972

7073
export default possibleValuesreducer;

0 commit comments

Comments
 (0)