Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Fix crash in company show when user has never been seen

François Zaninottod85b56d9af53
diff --git a/src/companies/CompanyShow.tsx b/src/companies/CompanyShow.tsx
index 5580455f..e09c00be 100644
--- a/src/companies/CompanyShow.tsx
+++ b/src/companies/CompanyShow.tsx
@@ -166,17 +166,19 @@ const ContactsIterator = () => {
</>
}
/>
- <ListItemSecondaryAction>
- <Typography
- variant="body2"
- color="textSecondary"
- component="span"
- >
- last activity{' '}
- {formatDistance(contact.last_seen, now)} ago{' '}
- <Status status={contact.status} />
- </Typography>
- </ListItemSecondaryAction>
+ {contact.last_seen && (
+ <ListItemSecondaryAction>
+ <Typography
+ variant="body2"
+ color="textSecondary"
+ component="span"
+ >
+ last activity{' '}
+ {formatDistance(contact.last_seen, now)} ago{' '}
+ <Status status={contact.status} />
+ </Typography>
+ </ListItemSecondaryAction>
+ )}
</ListItem>
</RecordContextProvider>
))}