diff --git a/packages/app/src/domain/behavior/behavior-per-age-group-tile.tsx b/packages/app/src/domain/behavior/behavior-per-age-group-tile.tsx index 242ea8433d..807b63d523 100644 --- a/packages/app/src/domain/behavior/behavior-per-age-group-tile.tsx +++ b/packages/app/src/domain/behavior/behavior-per-age-group-tile.tsx @@ -39,8 +39,10 @@ export function BehaviorPerAgeGroup({ }: BehaviorPerAgeGroupProps) { const breakpoints = useBreakpoints(); - const complianceValue = data[`${currentId}_compliance` as keyof typeof data]; - const supportValue = data[`${currentId}_support` as keyof typeof data]; + const complianceValue = + data[`${currentId}_compliance` as keyof typeof data] || undefined; + const supportValue = + data[`${currentId}_support` as keyof typeof data] || undefined; assert( typeof complianceValue !== 'number', @@ -52,9 +54,11 @@ export function BehaviorPerAgeGroup({ ); const hasComplianceValues = + complianceValue && keys(complianceValue).every((key) => complianceValue[key] === null) === - false; + false; const hasSupportValues = + supportValue && keys(supportValue).every((key) => supportValue[key] === null) === false; const dataAvailable = hasComplianceValues || hasSupportValues; @@ -85,41 +89,42 @@ export function BehaviorPerAgeGroup({
- {AGE_KEYS.map((age, index) => ( -