Skip to content

Commit

Permalink
Merge pull request #4147 from marmelab/fix-referencefield-in-simpleform
Browse files Browse the repository at this point in the history
Fix ReferenceField when used inside form
  • Loading branch information
djhi authored Dec 12, 2019
2 parents e434745 + a7a2b83 commit 7b5cf78
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/ra-ui-materialui/src/field/ReferenceField.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ const ReferenceField = ({ children, record, source, ...props }) => {
if (React.Children.count(children) !== 1) {
throw new Error('<ReferenceField> only accepts a single child');
}
const id = get(record, source);
const { loaded, error, referenceRecord } = useReference({
...props,
id,
reference: props.reference,
id: get(record, source),
});
const resourceLinkPath = getResourceLinkPath({ record, source, ...props });

Expand Down Expand Up @@ -110,7 +109,6 @@ ReferenceField.defaultProps = {
addLabel: true,
classes: {},
link: 'edit',
record: {},
};

const useStyles = makeStyles(theme => ({
Expand Down

0 comments on commit 7b5cf78

Please sign in to comment.