Skip to content

Commit

Permalink
Fix last control units emptiness check in vessel sidebar controls tab
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Sep 9, 2024
1 parent a9a514c commit 56432fd
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ type LastControlProps = {
export function LastControl({ field }: LastControlProps) {
const { control, text } = field
const controlUnits =
control?.controlUnits.map(controlUnit => controlUnit.name.replace('(historique)', '')).join(', ') ??
'Unité manquante'
!!control && control.controlUnits.length > 0
? control.controlUnits.map(controlUnit => controlUnit.name.replace('(historique)', '')).join(', ')
: 'Unité manquante'

const numberOfInfractions = useMemo(() => getNumberOfInfractions(control), [control])

Expand Down

0 comments on commit 56432fd

Please sign in to comment.