-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add ListContext to ReferenceArrayInput #5886
Conversation
djhi
commented
Feb 8, 2021
•
edited
Loading
edited
- Implementation
- Ability to select rows to change the input value
- Tests
- Documentation
44406e2
to
7eeb242
Compare
This should be PRed against |
d5aace6
to
8382e14
Compare
const context = useContext(ReferenceArrayInputContext); | ||
|
||
if (props.choices) { | ||
return props; |
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.
Please use a more fine-grained approach, as in useListContext in master
@@ -0,0 +1,9 @@ | |||
import { Record, RecordMap } from '../types'; | |||
|
|||
export const indexById = (records: Record[] = []): RecordMap => |
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.
please add jsDoc with sample input/output
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.
Done
const listContext = useMemo( | ||
() => ({ | ||
...controllerProps, | ||
setSort: controllerProps.setSortForList, |
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.
Please add a jsDoc explaining why you do some voodoo here
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.
Done
/> | ||
<ResourceContextProvider value={props.reference}> | ||
<ReferenceArrayInputContextProvider value={controllerProps}> | ||
<ListContextProvider value={listContext}> |
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 don't get it. What's the use of a ReferenceArrayInputContext if all you need is already in the ListContext?
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 agree it is mostly redundant now but it does provide the warning
prop which indicates non "fatal" errors regarding references.