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] Add Reference many input #597
Conversation
One question on |
@leesei I don't understand your question |
I see the task "Rename components to Array", so was wondering AOR's rule for using |
Here it's |
Switching to Ready For Review. @kimkha, as you can see, there was a lot to do to make your PR mergeable. |
You're awesome! 😍 So, how about the test? |
I should add somewhere that |
767e15d
to
19f7a3f
Compare
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.
Looks awesome!
Yet, I don't see any tests. :/
docs/Inputs.md
Outdated
</ReferenceArrayInput> | ||
``` | ||
|
||
**Tip**: `allowEmpty` is set by default for all Input components children of the `<Filter>` component: |
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.
s/component:/component/
As requested by jpetitcolas at https://github.com/marmelab/admin-on-rest/pull/597#discussion_r113906079
Regarding your Here is my code, few things to note:
|
Apparently I did not catch every case... We also need to resolve in
|
As requested by jpetitcolas at https://github.com/marmelab/admin-on-rest/pull/597#discussion_r113906079
251f4c8
to
006dba9
Compare
Now really green and ready for merge |
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.
Nice work !
export const getPossibleReferences = (state, referenceSource, reference, selectedIds = []) => { | ||
const possibleValues = state.admin.references.possibleValues[referenceSource] || []; | ||
if (selectedIds.length !== 0) { | ||
selectedIds.forEach(id => possibleValues.includes(id) || possibleValues.unshift(id)); |
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.
Aren't you mutating the current state here ? It would probably be safer to initialize possibleValues
from state with Array.from
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.
you're right - even if that was the case before that PR, too.
Thanks @kimkha! |
As requested by jpetitcolas at https://github.com/marmelab/admin-on-rest/pull/597#discussion_r113906079
As requested by jpetitcolas at https://github.com/marmelab/admin-on-rest/pull/597#discussion_r113906079
Has this input method been deprecated ? @fzaninotto |
@fr0Xy |
<ReferenceArrayInput>
<SelectArrayInput>
<SelectArrayInput>
, except when in a<ReferenceArrayInput>
Supersedes #484, closes #45