From 13495ab49579ba140b649f3a17017885897960c4 Mon Sep 17 00:00:00 2001 From: mz8i Date: Wed, 2 Oct 2019 16:47:45 +0100 Subject: [PATCH] Fix/map update (#450) * Move building deselect logic from map-app to mapp * Use building_id instead of ref_toid in handleClick --- app/src/frontend/map-app.tsx | 4 +--- app/src/frontend/map/map.tsx | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/frontend/map-app.tsx b/app/src/frontend/map-app.tsx index 89306535..9f77ee99 100644 --- a/app/src/frontend/map-app.tsx +++ b/app/src/frontend/map-app.tsx @@ -80,9 +80,7 @@ class MapApp extends React.Component { const mode = this.props.match.params.mode || 'view'; const category = this.props.match.params.category || 'age'; - if (building == undefined || - (this.state.building != undefined && - building.building_id === this.state.building.building_id)) { + if (building == undefined) { this.setState({ building: undefined }); this.props.history.push(`/${mode}/${category}`); return; diff --git a/app/src/frontend/map/map.tsx b/app/src/frontend/map/map.tsx index a0f26ee6..15f80cfc 100644 --- a/app/src/frontend/map/map.tsx +++ b/app/src/frontend/map/map.tsx @@ -77,8 +77,10 @@ class ColouringMap extends Component { // if (mode === 'multi-edit') { // colour building directly this.props.colourBuilding(building); - } else { + } else if (this.props.building == undefined || building.building_id !== this.props.building.building_id){ this.props.selectBuilding(building); + } else { + this.props.selectBuilding(undefined); } } else { // deselect but keep/return to expected colour theme