From 4f77629eb7a35c89a897d932556bf0ae19774bb4 Mon Sep 17 00:00:00 2001 From: orangemug Date: Tue, 8 Sep 2020 17:58:33 +0100 Subject: [PATCH] Fix to not change layer key while editing layer. --- src/components/App.jsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/App.jsx b/src/components/App.jsx index a88cd56..779fee4 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -772,7 +772,10 @@ export default class App extends React.Component { } } if (!invalid) { - this.setState({selectedLayerIndex}); + this.setState({ + selectedLayerIndex, + selectedLayerOriginalId: this.state.mapStyle.layers[selectedLayerIndex].id, + }); } } catch (err) { @@ -782,7 +785,10 @@ export default class App extends React.Component { } onLayerSelect = (index) => { - this.setState({ selectedLayerIndex: index }, this.setStateInUrl); + this.setState({ + selectedLayerIndex: index, + selectedLayerOriginalId: this.state.mapStyle.layers[index].id, + }, this.setStateInUrl); } setModal(modalName, value) { @@ -851,7 +857,7 @@ export default class App extends React.Component { /> const layerEditor = selectedLayer ?