Skip to content

Commit

Permalink
Fix bug when categorical color is missing (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
luisvasq committed Nov 22, 2024
1 parent fa8fb1b commit 9c1f038
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ui/views/map/ColorLegend.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,12 @@ const CategoricalColorLegend = ({ type, colorByProp, onChangeColor }) => {
orderEntireDict, // Preserve order of options after state updates
// Add fallback color for null values, if available
R.when(R.always(fallback?.color != null), R.assoc('null', fallback)),
R.map(R.pick(['name', 'color']))
R.map(
R.applySpec({
name: R.prop('name'),
color: R.propOr('#000', 'color'), // In case `color` is missing
})
)
)(options)
}, [colorByProp])

Expand Down

0 comments on commit 9c1f038

Please sign in to comment.