Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Close Disambiguation Popup on New Search #825

Merged
merged 2 commits into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Fixed
- Close Disambiguation Popup on Reset [#812](https://github.com/open-apparel-registry/open-apparel-registry/pull/812)
- Close Disambiguation Popup on New Search [#825](https://github.com/open-apparel-registry/open-apparel-registry/pull/825)
- Change "Accept" to "Confirm" in About/Processing [#815](https://github.com/open-apparel-registry/open-apparel-registry/pull/815)
- Regularize vector tile map zoom behavior [#799](https://github.com/open-apparel-registry/open-apparel-registry/pull/799)

Expand Down
12 changes: 11 additions & 1 deletion src/app/src/components/FacilitiesMap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const unselectedMarkerIcon = createIcon(unselectedMarkerURL);
const selectedMarkerIcon = createIcon(selectedMarkerURL);

function FacilitiesMap({
fetching,
data,
navigateToFacilityDetails,
facilityDetailsData,
Expand Down Expand Up @@ -226,6 +227,13 @@ function FacilitiesMap({
setFacilitiesToDisambiguate,
]);

useEffect(() => {
// Close multiple facilities popup on fresh searches
if (fetching) {
setFacilitiesToDisambiguate(null);
}
}, [fetching]);
rajadain marked this conversation as resolved.
Show resolved Hide resolved

if (!clientInfoFetched) {
return null;
}
Expand Down Expand Up @@ -358,6 +366,7 @@ FacilitiesMap.defaultProps = {
};

FacilitiesMap.propTypes = {
fetching: bool.isRequired,
data: facilityCollectionPropType,
navigateToFacilityDetails: func.isRequired,
facilityDetailsData: facilityPropType,
Expand All @@ -373,7 +382,7 @@ FacilitiesMap.propTypes = {

function mapStateToProps({
facilities: {
facilities: { data },
facilities: { fetching, data },
singleFacility: { data: facilityDetailsData },
},
ui: {
Expand All @@ -382,6 +391,7 @@ function mapStateToProps({
clientInfo: { fetched, countryCode },
}) {
return {
fetching,
data,
facilityDetailsData,
resetButtonClickCount,
Expand Down
7 changes: 7 additions & 0 deletions src/app/src/components/VectorTileFacilitiesLayer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,13 @@ const VectorTileFacilitiesLayer = ({
}
};

useEffect(() => {
// Close multiple facilities popup on fresh searches
if (fetching) {
closeMultipleFacilitiesPopup();
}
}, [fetching]);

return (
<>
<VectorGrid
Expand Down