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