Skip to content
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

[TypeScript] Fix useReferenceManyFieldController argument type #8491

Merged
merged 1 commit into from
Dec 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface UseReferenceManyFieldControllerParams {
perPage?: number;
record?: RaRecord;
reference: string;
resource: string;
resource?: string;
sort?: SortPayload;
source?: string;
target: string;
Expand All @@ -29,33 +29,26 @@ const defaultFilter = {};
/**
* Fetch reference records, and return them when available
*
* The reference prop should be the name of one of the <Resource> components
* added as <Admin> child.
*
* @example
* Uses dataProvider.getManyReference() internally.
*
* @example // fetch the comments related to the current post
* const { isLoading, data } = useReferenceManyFieldController({
* resource
* reference: 'users',
* record: {
* userId: 7
* }
* target: 'comments',
* source: 'userId',
* page: 1,
* perPage: 25,
* reference: 'comments',
* target: 'post_id',
* record: { id: 123, title: 'hello, world' },
* resource: 'posts',
* });
*
* @param {Object} props
* @param {string} props.resource The current resource name
* @param {string} props.reference The linked resource name
* @param {Object} props.record The current resource record
* @param {string} props.target The target resource key
* @param {string} props.reference The linked resource name. Required.
* @param {string} props.target The target resource key. Required.
* @param {Object} props.filter The filter applied on the recorded records list
* @param {string} props.source The key of the linked resource identifier
* @param {number} props.page the page number
* @param {number} props.perPage the number of item per page
* @param {Object} props.record The current resource record
* @param {string} props.resource The current resource name
* @param {Object} props.sort the sort to apply to the referenced records
* @param {string} props.source The key of the linked resource identifier
*
* @returns {ListControllerResult} The reference many props
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import { PublicFieldProps, fieldPropTypes, InjectedFieldProps } from './types';
* ...
* </ReferenceManyField>
*/
export const ReferenceManyField: FC<ReferenceManyFieldProps> = props => {
export const ReferenceManyField = (props: ReferenceManyFieldProps) => {
const {
children,
filter,
Expand Down