Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[Fix] ColorBlock component TypeError: e.color.slice(...).join is not a function (#2212)

Igor Dd8a5defaf61d
diff --git a/src/components/src/side-panel/layer-panel/color-selector.tsx b/src/components/src/side-panel/layer-panel/color-selector.tsx
index 29eadb3fd..260f4b51b 100644
--- a/src/components/src/side-panel/layer-panel/color-selector.tsx
+++ b/src/components/src/side-panel/layer-panel/color-selector.tsx
@@ -52,7 +52,10 @@ export const ColorBlock = styled.div<{backgroundcolor: RGBColor}>`
width: 32px;
height: 18px;
border-radius: 1px;
- background-color: ${props => `rgb(${props.backgroundcolor.slice(0, 3).join(',')})`};
+ background-color: ${props =>
+ Array.isArray(props.backgroundcolor)
+ ? `rgb(${props.backgroundcolor.slice(0, 3).join(',')})`
+ : 'transparent'};
`;
export const ColorSelectorInput = styled.div<ColorSelectorInputProps>`