ReferenceField always display
See original GitHub issueHello, thanks you for your project. I think there is a bug with ReferenceField. When I use ReferenceField and the source is null, the loading appears but remains indefinitely. I have the impression that the field does not check before if the source is not null.
I was able to correct this by doing it like that but I think there must be a better solution:
const ConditionalReferenceField = ({ record, ...rest }) =>
record && record[rest.source] ? (
<ReferenceField {...rest}>
<TextField source="name" />
</ReferenceField>
) : null;
- React-admin version: 2.3.3
- Last version that did not exhibit the issue (if applicable): no applicable
- React version: 16.5.2
- Browser: Chrome
- Stack trace (in case of a JS error): no
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Reference field is not showing the expected display value ...
A reference field is not showing the expected display value when selected or it appears blank. Cause. It could be due to one...
Read more >View title is always displayed if the extra setting is hidden
View title is always displayed if the extra setting is hidden. Reviewed & tested by the community. Project: Views Reference Field. Version:.
Read more >Add a 'target' field to <ReferenceField> #5581 - GitHub
I want to use a ReferenceField, to lookup a (single) resource based on a ... the target resource exists or not (so it's...
Read more >React-admin - Field Components - Marmelab
Tip: Always check the record is defined before inspecting its properties, as react-admin may display the Show view before fetching the record from...
Read more >Custom reference field apps in the Contentful App Framework
Ever wondered how to use the Contentful App Framework to create a custom reference field app? In this post, we'll show you how....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think you can use the allowEmpty={true} attribute on the ReferenceField
Refixed in #3550