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

[Doc] Explain ReferenceOneField usage with one-to-many relationships #8660

Merged
merged 2 commits into from
Feb 20, 2023

Conversation

fzaninotto
Copy link
Member

@fzaninotto fzaninotto commented Feb 15, 2023

The real power of ReferenceOneField lies on one-to-many relationships. We should make it more obvious.

| `queryOptions` | Optional | [`UseQueryOptions`](https://tanstack.com/query/v4/docs/reference/useQuery?from=reactQueryV3&original=https://react-query-v3.tanstack.com/reference/useQuery) | `{}` | `react-query` client options |
| `sort` | Optional | `{ field: String, order: 'ASC' or 'DESC' }` | `{ field: 'id', order: 'ASC' }` | Used to order referenced records |

`<ReferenceOneField>` also accepts the [common field props](./Fields.md#common-field-props), except `emptyText` (use the child `empty` prop instead).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the code, emptyText seems to be supported, and it might be useful for when you don't provide children

docs/ReferenceOneField.md Outdated Show resolved Hide resolved
@fzaninotto fzaninotto added this to the 4.8.1 milestone Feb 20, 2023
Co-authored-by: Jean-Baptiste Kaiser <jb@marmelab.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants