Handle undefined position values

This commit is contained in:
Anton Tananaev 2024-10-31 16:16:14 -07:00
parent 599369694e
commit 274ee5256b

View File

@ -93,6 +93,10 @@ const PositionValue = ({ position, property, attribute }) => {
}
};
if (value === undefined) {
return '';
}
switch (key) {
case 'image':
case 'video':
@ -110,20 +114,11 @@ const PositionValue = ({ position, property, attribute }) => {
case 'address':
return <AddressValue latitude={position.latitude} longitude={position.longitude} originalAddress={value} />;
case 'network':
if (value) {
return <Link component={RouterLink} underline="none" to={`/network/${position.id}`}>{t('sharedInfoTitle')}</Link>;
}
return '';
return <Link component={RouterLink} underline="none" to={`/network/${position.id}`}>{t('sharedInfoTitle')}</Link>;
case 'geofenceIds':
if (value) {
return <GeofencesValue geofenceIds={value} />;
}
return '';
return <GeofencesValue geofenceIds={value} />;
case 'driverUniqueId':
if (value) {
return <DriverValue driverUniqueId={value} />;
}
return '';
return <DriverValue driverUniqueId={value} />;
default:
return formatValue(value);
}