Skip to content

Commit f4186d2

Browse files
committed
Check render types are supported before displaying them
1 parent caf90c2 commit f4186d2

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

packages/base/src/dialogs/symbology/vector_layer/VectorRendering.tsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import Graduated from './types/Graduated';
66
import Heatmap from './types/Heatmap';
77
import SimpleSymbol from './types/SimpleSymbol';
88
import { useGetProperties } from '../hooks/useGetProperties';
9-
import { getColorCodeFeatureAttributes, getNumericFeatureAttributes } from '../../../tools';
9+
import {
10+
getColorCodeFeatureAttributes,
11+
getNumericFeatureAttributes
12+
} from '../../../tools';
1013

1114
const VectorRendering = ({
1215
model,
@@ -43,15 +46,17 @@ const VectorRendering = ({
4346
}
4447
setSelectedRenderType(renderType);
4548

46-
let vectorLayerOptions = [
47-
'Single Symbol',
48-
'Heatmap'
49-
]
50-
if (getColorCodeFeatureAttributes(featureProperties)) {
51-
vectorLayerOptions.push('Canonical')
49+
const vectorLayerOptions = ['Single Symbol', 'Heatmap'];
50+
51+
if (
52+
Object.keys(getColorCodeFeatureAttributes(featureProperties)).length > 0
53+
) {
54+
vectorLayerOptions.push('Canonical');
5255
}
53-
if (getNumericFeatureAttributes(featureProperties)) {
54-
vectorLayerOptions.push('Graduated', 'Categorized')
56+
if (
57+
Object.keys(getNumericFeatureAttributes(featureProperties)).length > 0
58+
) {
59+
vectorLayerOptions.push('Graduated', 'Categorized');
5560
}
5661

5762
const options: Record<string, string[]> = {
@@ -60,7 +65,7 @@ const VectorRendering = ({
6065
HeatmapLayer: ['Single Symbol', 'Graduated', 'Categorized', 'Heatmap']
6166
};
6267
setRenderTypeOptions(options[layer.type]);
63-
}, []);
68+
}, [featureProperties]);
6469

6570
useEffect(() => {
6671
switch (selectedRenderType) {

0 commit comments

Comments
 (0)