Skip to content

Commit

Permalink
[Maps] fix auto-refresh not auto fitting to bounds (#81251)
Browse files Browse the repository at this point in the history
* [Maps] trigger auto fit to bounds on refresh trigger

* default auto fit to data bounds to false

* update jest snapshots

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
nreese and kibanamachine authored Oct 26, 2020
1 parent a9d53f2 commit 7f0e1c8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
11 changes: 9 additions & 2 deletions x-pack/plugins/maps/public/actions/map_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,19 @@ export function setRefreshConfig({ isPaused, interval }: MapRefreshConfig) {
}

export function triggerRefreshTimer() {
return async (dispatch: ThunkDispatch<MapStoreState, void, AnyAction>) => {
return async (
dispatch: ThunkDispatch<MapStoreState, void, AnyAction>,
getState: () => MapStoreState
) => {
dispatch({
type: TRIGGER_REFRESH_TIMER,
});

await dispatch(syncDataForAllLayers());
if (getMapSettings(getState()).autoFitToDataBounds) {
dispatch(autoFitToBounds());
} else {
await dispatch(syncDataForAllLayers());
}
};
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { MapSettings } from './map';

export function getDefaultMapSettings(): MapSettings {
return {
autoFitToDataBounds: true,
autoFitToDataBounds: false,
initialLocation: INITIAL_LOCATION.LAST_SAVED_LOCATION,
fixedLocation: { lat: 0, lon: 0, zoom: 2 },
browserLocation: { zoom: 2 },
Expand Down

0 comments on commit 7f0e1c8

Please sign in to comment.