Guard against errors producing dirty map state.

This commit is contained in:
orangemug 2020-02-16 18:22:21 +00:00
parent 29a0ef0d1c
commit a5ac1cc93d

View file

@ -354,8 +354,15 @@ export default class App extends React.Component {
errors.forEach(error => { errors.forEach(error => {
const {message} = error; const {message} = error;
const objPath = message.split(":")[0]; if (message) {
unset(dirtyMapStyle, objPath); try {
const objPath = message.split(":")[0];
unset(dirtyMapStyle, objPath);
}
catch (err) {
console.warn(err);
}
}
}); });
} }
@ -475,7 +482,6 @@ export default class App extends React.Component {
} }
onLayerChanged = (layer) => { onLayerChanged = (layer) => {
console.log("test: onLayerChanged", layer);
const changedLayers = this.state.mapStyle.layers.slice(0) const changedLayers = this.state.mapStyle.layers.slice(0)
const idx = style.indexOfLayer(changedLayers, layer.id) const idx = style.indexOfLayer(changedLayers, layer.id)
changedLayers[idx] = layer changedLayers[idx] = layer