Skip to content

Commit

Permalink
Merge pull request #1812 from bphan002/1805-fix-loading-spinner-on-mo…
Browse files Browse the repository at this point in the history
…use-over-popups

1805 fix loading spinner on mouse over popups
  • Loading branch information
bphan002 authored Sep 12, 2024
2 parents d68ff87 + 31bf987 commit be99cba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/Map/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import mapboxgl from 'mapbox-gl';
import FilterMenu from '@components/main/Desktop/FilterMenu';
// import LocationDetail from './LocationDetail';
import { REQUEST_TYPES } from '@components/common/CONSTANTS';
import { getNcByLngLat } from '@reducers/data';
import { getNcByLngLat, clearPinInfo } from '@reducers/data';
import {
updateNcId,
updateSelectedCouncils,
Expand Down Expand Up @@ -457,6 +457,7 @@ class Map extends React.Component {
};

onMouseLeave = (e) => {
this.props.dispatchClearPinInfo()
this.removePopup();
};

Expand Down Expand Up @@ -794,6 +795,7 @@ const mapDispatchToProps = (dispatch) => ({
dispatchUpdateUnselectedCouncils: (councils) =>
dispatch(updateUnselectedCouncils(councils)),
dispatchCloseBoundaries: () => dispatch(closeBoundaries()),
dispatchClearPinInfo: () => dispatch(clearPinInfo()),
});

// We need to specify forwardRef to allow refs on connected components.
Expand Down
11 changes: 11 additions & 0 deletions redux/reducers/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const types = {
GET_OPEN_REQUESTS_SUCCESS: 'GET_OPEN_REQUESTS_SUCCESS',
GET_OPEN_REQUESTS_FAILURE: 'GET_OPEN_REQUESTS_FAILURE',
UPDATE_PIN_INFO: 'UPDATE_PIN_INFO',
CLEAR_PIN_INFO: 'CLEAR_PIN_INFO',
GET_PIN_INFO_REQUEST: 'GET_PIN_INFO_REQUEST',
GET_PIN_INFO_SUCCESS: 'GET_PIN_INFO_SUCCESS',
GET_PIN_INFO_FAILURE: 'GET_PIN_INFO_FAILURE',
Expand Down Expand Up @@ -64,6 +65,10 @@ export const updatePinInfo = pinData => ({
payload: pinData,
});

export const clearPinInfo = () => ({
type: types.CLEAR_PIN_INFO,
});

export const getPinInfoRequest = requestId => ({
type: types.GET_PIN_INFO_REQUEST,
payload: requestId,
Expand Down Expand Up @@ -211,6 +216,12 @@ export default (state = initialState, action) => {
...action.payload,
},
};
case types.CLEAR_PIN_INFO:
return {
...state,
error: null,
pinsInfo: {},
};
case types.GET_PIN_INFO_SUCCESS:
return {
...state,
Expand Down

0 comments on commit be99cba

Please # to comment.