Skip to content

Commit

Permalink
[Maps] Disable draw mode on layer remove (elastic#103188)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
Aaron Caldwell and kibanamachine committed Jun 24, 2021
1 parent cebf16f commit c0122f7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions x-pack/plugins/maps/public/actions/layer_actions.ts
Expand Up @@ -11,6 +11,7 @@ import { Query } from 'src/plugins/data/public';
import { MapStoreState } from '../reducers/store';
import {
createLayerInstance,
getEditState,
getLayerById,
getLayerList,
getLayerListRaw,
Expand Down Expand Up @@ -481,6 +482,11 @@ function removeLayerFromLayerList(layerId: string) {
type: REMOVE_LAYER,
id: layerId,
});
// Clean up draw state if needed
const editState = getEditState(getState());
if (layerId === editState?.layerId) {
dispatch(setDrawMode(DRAW_MODE.NONE));
}
};
}

Expand Down

0 comments on commit c0122f7

Please sign in to comment.