-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFR] Fix ReferenceArrayInput does not work in Filters #3898
Conversation
return { | ||
choices: dataStatus.choices, | ||
error: dataStatus.error, | ||
loaded, | ||
loading: dataStatus.waiting, | ||
referenceBasePath, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is never used by child components. It was not passed in 2.0. I think it comes from a bad copy/paste of ReferenceArrayField during the hooks refactoring.
@@ -115,7 +114,7 @@ const useReferenceArrayInputController = ({ | |||
// the component displaying the currently selected records may fail | |||
const finalMatchingReferences = | |||
matchingReferences && matchingReferences.length > 0 | |||
? matchingReferences.concat(finalReferenceRecords) | |||
? mergeReferences(matchingReferences, finalReferenceRecords) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was creating warnings about duplicate keys: selected values that were also in the list of possible choices were displayed twice!
@@ -10,130 +10,6 @@ import LinearProgress from '../layout/LinearProgress'; | |||
import Labeled from '../input/Labeled'; | |||
import ReferenceError from './ReferenceError'; | |||
|
|||
const sanitizeRestProps = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just moved the View part at the bottom of the file so that the jsDoc appears first. It's easier to read that way.
@@ -262,7 +263,7 @@ const SelectArrayInput: FunctionComponent< | |||
}; | |||
|
|||
SelectArrayInput.propTypes = { | |||
choices: PropTypes.arrayOf(PropTypes.object).isRequired, | |||
choices: PropTypes.arrayOf(PropTypes.object), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
choices are empty when declaring the input in a form:
<ReferenceArrayInput label="Tags" source="tags" reference="tags">
<SelectArrayInput optionText="name" />
</ReferenceArrayInput>
closes #3883