Skip to content

Commit 54fecb2

Browse files
authored
Merge pull request #1910 from bphan002/1902-de-select-nc-selection-on-outside-click
1902 de select nc selection on outside click
2 parents 8c43ecc + 459131a commit 54fecb2

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

components/Map/Map.jsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ class Map extends React.Component {
437437
};
438438

439439
reset = () => {
440-
const { dispatchUpdateNcId } = this.props;
440+
const { dispatchUpdateNcId, dispatchUpdateSelectedCouncils } = this.props;
441441

442442
this.zoomOut();
443443
this.addressLayer.clearMarker();
@@ -463,23 +463,18 @@ class Map extends React.Component {
463463
});
464464

465465
// Reset MinZoom to original value after deselecting NC
466+
this.resetBoundaries();
467+
dispatchUpdateSelectedCouncils([])
466468
this.map.setMinZoom(DEFAULT_MIN_ZOOM);
467469
};
468470

469471
resetBoundaries = () => {
470472
const {
471473
dispatchUpdateNcId,
472-
dispatchUpdateSelectedCouncils,
473-
dispatchUpdateUnselectedCouncils,
474-
councils,
475474
} = this.props;
476475

477476
// Reset the selected NcId back to null.
478477
dispatchUpdateNcId(null);
479-
480-
// Reset councilSelector.
481-
dispatchUpdateSelectedCouncils([]);
482-
dispatchUpdateUnselectedCouncils(councils);
483478
};
484479

485480
addressSearchIsEmpty = () => {

components/main/Desktop/CouncilSelector/index.jsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,8 @@ function CouncilSelector({
4444
}, [councils, dispatchUpdateUnselectedCouncils]);
4545

4646
const handleDelete = e => {
47-
const deletedCouncilId = Number(e.currentTarget.dataset.id);
48-
const newSelected = selected.filter(
49-
({ councilId }) => councilId !== deletedCouncilId,
50-
);
51-
const newUnselected = not(councils, newSelected, 'councilId');
52-
dispatchUpdateSelectedCouncils(newSelected);
53-
dispatchUpdateUnselectedCouncils(newUnselected);
5447
// Clear out address search input
5548
resetAddressSearch();
56-
57-
// resetMap() will call dispatchUpdateNcId(null) to reset councilId back to null
58-
// in reducers/filters so no need to do it again here
5949
resetMap();
6050
//Clear district council search box field on deselect
6151
setSearchTerm('');

0 commit comments

Comments
 (0)