diff --git a/app/charts/map/map-legend.tsx b/app/charts/map/map-legend.tsx index 979405f421..6f8242129f 100644 --- a/app/charts/map/map-legend.tsx +++ b/app/charts/map/map-legend.tsx @@ -199,7 +199,7 @@ const CircleLegend = () => { const domainObservations = useMemo( () => dataDomain.map((d) => data.find((x) => getValue(x) === d)), [data, dataDomain, getValue] - ) as [Observation, Observation]; + ) as [Observation | undefined, Observation | undefined]; return ( @@ -210,11 +210,12 @@ const CircleLegend = () => { > {dataDomain.map((d, i) => { const observation = domainObservations[i]; - const label = getLabel(observation); - const radius = radiusScale(d); - return ( - observation && ( + if (observation) { + const label = getLabel(observation); + const radius = radiusScale(d); + + return ( <> { { /> } - ) - ); + ); + } })} {/* Hovered data point indicator */}