From fb1a2bb1c161900102cb278330db24a5467c1ab3 Mon Sep 17 00:00:00 2001 From: Michael Hudson Nkotagu Date: Wed, 28 Aug 2024 13:39:09 +0300 Subject: [PATCH] chore: Use optional chaining (?.) for safe property access --- packages/hurumap-next/src/Map/Layers.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/hurumap-next/src/Map/Layers.js b/packages/hurumap-next/src/Map/Layers.js index 0cf39e485..dd9ba7175 100644 --- a/packages/hurumap-next/src/Map/Layers.js +++ b/packages/hurumap-next/src/Map/Layers.js @@ -75,7 +75,8 @@ function Layers({ const locationCodes = locationCodesProp?.map((c) => c.toUpperCase()) || []; if (!locationCodes?.includes(feature.properties.code.toUpperCase())) { - geoStyles.inactive.color = choropleth[0].color; + geoStyles.inactive.color = + choropleth?.[0]?.color ?? geoStyles.inactive.color; layer.setStyle(geoStyles.inactive); } else { const popUpContent = (level, name) =>