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

ReferenceField ignores emptyText prop #5573

Closed
fvoordeckers opened this issue Nov 23, 2020 · 1 comment · Fixed by #5579
Closed

ReferenceField ignores emptyText prop #5573

fvoordeckers opened this issue Nov 23, 2020 · 1 comment · Fixed by #5579
Assignees
Labels

Comments

@fvoordeckers
Copy link

What you were expecting:
Other fields like TextField allow an emptyText prop to pass a text value to render when the prop is empty or does not exist on the record. Would expect the same result for a ReferenceField when the source passed to the ReferenceField is empty on the record.

What happened instead:
The field rendered an empty value.

Steps to reproduce:

  1. Add a ReferenceField to a show view or a list with an emptyText prop.
  2. Add a record without the reference value

Related code:

<ReferenceField label="Parent" source="parentId" reference="categories" emptyText="-">
    <TextField source="name" />
 </ReferenceField>

Other information:

Environment

  • React-admin version: 3.8.2
@fzaninotto
Copy link
Member

emptyText was introduced in #4413 by a member of the community. It seems they forgot the ReferenceField...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants