[v10.4.x] Users: Add back check for undefined / null for value for lastSeenAtAge in table view (#84285)

Users: Add back check for undefined / null for value for `lastSeenAtAge` in table view (#84265)

bug: add check for undefined / null for value
(cherry picked from commit 0cb9f2bb8d)

Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-03-12 15:37:40 +02:00
committed by GitHub
co-authored by Eric Leijonmarck
parent 0a0e9f70cd
commit 1d582410ab
2 changed files with 2 additions and 2 deletions
@@ -109,7 +109,7 @@ export const OrgUsersTable = ({
id: 'lastSeenAtAge',
header: 'Last active',
cell: ({ cell: { value } }: Cell<'lastSeenAtAge'>) => {
return <>{value && value === '10 years' ? <Text color={'disabled'}>Never</Text> : value}</>;
return <>{value && <>{value === '10 years' ? <Text color={'disabled'}>Never</Text> : value}</>}</>;
},
sortType: (a, b) => new Date(a.original.lastSeenAt).getTime() - new Date(b.original.lastSeenAt).getTime(),
},
@@ -117,7 +117,7 @@ export const UsersTable = ({
iconName: 'question-circle',
},
cell: ({ cell: { value } }: Cell<'lastSeenAtAge'>) => {
return <>{value && value === '10 years' ? <Text color={'disabled'}>Never</Text> : value}</>;
return <>{value && <>{value === '10 years' ? <Text color={'disabled'}>Never</Text> : value}</>}</>;
},
sortType: (a, b) => new Date(a.original.lastSeenAt!).getTime() - new Date(b.original.lastSeenAt!).getTime(),
},