diff --git a/examples/crm/src/companies/CompanyAside.tsx b/examples/crm/src/companies/CompanyAside.tsx index 878becd4f71..247e2d7e450 100644 --- a/examples/crm/src/companies/CompanyAside.tsx +++ b/examples/crm/src/companies/CompanyAside.tsx @@ -9,7 +9,7 @@ import { } from 'react-admin'; import { Box, Typography, Divider, Link } from '@material-ui/core'; -import { Company } from '../types'; +import { Company, Sale } from '../types'; export const CompanyAside = ({ record, @@ -92,10 +92,12 @@ export const CompanyAside = ({ source="sales_id" reference="sales" > - source="last_name" - render={(record: any) => - `${record.first_name} ${record.last_name}` + render={record => + record + ? `${record.first_name} ${record.last_name}` + : '' } /> diff --git a/examples/crm/src/contacts/ContactAside.tsx b/examples/crm/src/contacts/ContactAside.tsx index 600b963c133..19a90451d72 100644 --- a/examples/crm/src/contacts/ContactAside.tsx +++ b/examples/crm/src/contacts/ContactAside.tsx @@ -13,6 +13,8 @@ import { import { Box, Typography, Divider, List, ListItem } from '@material-ui/core'; import { TagsListEdit } from './TagsListEdit'; +import { Sale } from '../types'; + export const ContactAside = ({ record, link = 'edit' }: any) => ( @@ -89,10 +91,10 @@ export const ContactAside = ({ record, link = 'edit' }: any) => ( source="sales_id" reference="sales" > - source="last_name" - render={(record: any) => - `${record.first_name} ${record.last_name}` + render={record => + record ? `${record.first_name} ${record.last_name}` : '' } /> diff --git a/examples/crm/src/dashboard/LatestNotes.tsx b/examples/crm/src/dashboard/LatestNotes.tsx index 1659340e589..01519537d86 100644 --- a/examples/crm/src/dashboard/LatestNotes.tsx +++ b/examples/crm/src/dashboard/LatestNotes.tsx @@ -11,6 +11,8 @@ import { } from 'react-admin'; import { formatDistance } from 'date-fns'; +import { Contact as ContactType } from '../types'; + const useStyles = makeStyles(theme => ({ note: { marginBottom: theme.spacing(2), @@ -148,10 +150,10 @@ const Contact = ({ note }: any) => ( basePath="/contacts" link="show" > - variant="body1" - render={(contact: any) => - `${contact.first_name} ${contact.last_name}` + render={contact => + contact ? `${contact.first_name} ${contact.last_name}` : '' } />