From a8f62085613c0d70e0632b98ff343f4b1641cbd0 Mon Sep 17 00:00:00 2001 From: Filip Proborszcz Date: Sun, 1 May 2022 11:28:15 +0200 Subject: [PATCH] Fix layer drag&drop and init warning --- src/components/App.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/App.jsx b/src/components/App.jsx index d0a00b05..b41486d4 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -486,7 +486,7 @@ export default class App extends React.Component { } layers = layers.slice(0); - layers = arrayMoveMutable(layers, oldIndex, newIndex); + arrayMoveMutable(layers, oldIndex, newIndex); this.onLayersChange(layers); } @@ -764,17 +764,17 @@ export default class App extends React.Component { parseInt(parts[1], 10), ]; - let invalid = false; + let valid = true; if (hashVal !== "-") { const currentHashVal = hash(JSON.stringify(mapStyle)); if (currentHashVal !== parseInt(hashVal, 10)) { - invalid = true; + valid = false; } } - if (!invalid) { + if (valid) { this.setState({ selectedLayerIndex, - selectedLayerOriginalId: this.state.mapStyle.layers[selectedLayerIndex].id, + selectedLayerOriginalId: mapStyle.layers[selectedLayerIndex].id, }); } }