Fix/map update (#450)

* Move building deselect logic from map-app to mapp

* Use building_id instead of ref_toid in handleClick
This commit is contained in:
mz8i 2019-10-02 16:47:45 +01:00 committed by GitHub
parent 14bc6e0d91
commit 13495ab495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -80,9 +80,7 @@ class MapApp extends React.Component<MapAppProps, MapAppState> {
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;

View File

@ -77,8 +77,10 @@ class ColouringMap extends Component<ColouringMapProps, ColouringMapState> { //
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