Skip to content

Commit b47a58c

Browse files
Add a check on the type of the layer in onSelectedLayerChange to prevent calling editVectorLayer on irrelevant layers.
1 parent 673bfd6 commit b47a58c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/base/src/mainview/mainView.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,9 +2247,16 @@ export class MainView extends React.Component<IProps, IStates> {
22472247
? Object.keys(selectedLayers)[0]
22482248
: undefined;
22492249
if (selectedLayerId && selectedLayerId !== this._previousDrawLayerID) {
2250-
this._previousDrawLayerID = selectedLayerId;
2251-
this._currentDrawLayerID = selectedLayerId;
2252-
this._editVectorLayer();
2250+
const selectedLayer = this._model.getLayer(selectedLayerId);
2251+
if (selectedLayer) {
2252+
if (this._model.checkIfIsADrawVectorLayer(selectedLayer)) {
2253+
this._previousDrawLayerID = selectedLayerId;
2254+
this._currentDrawLayerID = selectedLayerId;
2255+
this._editVectorLayer();
2256+
} else {
2257+
console.warn(`${selectedLayer.name} is not editable`);
2258+
}
2259+
}
22532260
}
22542261
};
22552262

0 commit comments

Comments
 (0)