Skip to content

Commit

Permalink
fix: make permalink more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
friedjoff committed Jul 7, 2020
1 parent a322c72 commit c80aeef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/components/LocationResult.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
import { useHistory, useLocation } from 'react-router-dom';
import { useHistory } from 'react-router-dom';
import { Form, Header, Message } from 'semantic-ui-react';
// eslint-disable-next-line import/no-unresolved
import { info } from 'lib/src';
Expand All @@ -27,10 +27,9 @@ function LocationResult() {
}));

const history = useHistory();
const { search } = useLocation();
const selectForestType = (forestType) => {
dispatch(setFormLocation({ forestType }));
history.push(`/projection${search}`);
const selectForestType = async (forestType) => {
await dispatch(setFormLocation({ forestType }));
history.push(`/projection${history.location.search}`);
};
const hasMainGroup =
!formLocation.groups || formLocation.groups.includes('main');
Expand Down
3 changes: 2 additions & 1 deletion src/store/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ function tree(state = initialState, action) {
case SET_MAP_LAYER:
return { ...state, mapLayer: action.mapLayer };
case SET_MAP_LOCATION: {
return { ...state, mapLocation: action.mapLocation, projectionMode: 'm' };
const mapLocation = { ...state.mapLocation, ...action.mapLocation };
return { ...state, mapLocation, projectionMode: 'm' };
}
case SET_MAP_VIEW:
return { ...state, mapView: action.mapView };
Expand Down

0 comments on commit c80aeef

Please sign in to comment.