Skip to content

Commit

Permalink
chore: Use optional chaining (?.) for safe property access
Browse files Browse the repository at this point in the history
  • Loading branch information
m453h committed Aug 28, 2024
1 parent 917a2c1 commit fb1a2bb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/hurumap-next/src/Map/Layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down

0 comments on commit fb1a2bb

Please sign in to comment.