Skip to content

Commit ed137cc

Browse files
Aaron Caldwellkibanamachine
andcommitted
[Maps] Disable draw mode on layer remove (#103188)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
1 parent 6c49247 commit ed137cc

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

x-pack/plugins/maps/public/actions/layer_actions.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { Query } from 'src/plugins/data/public';
1111
import { MapStoreState } from '../reducers/store';
1212
import {
1313
createLayerInstance,
14+
getEditState,
1415
getLayerById,
1516
getLayerList,
1617
getLayerListRaw,
@@ -481,6 +482,11 @@ function removeLayerFromLayerList(layerId: string) {
481482
type: REMOVE_LAYER,
482483
id: layerId,
483484
});
485+
// Clean up draw state if needed
486+
const editState = getEditState(getState());
487+
if (layerId === editState?.layerId) {
488+
dispatch(setDrawMode(DRAW_MODE.NONE));
489+
}
484490
};
485491
}
486492

0 commit comments

Comments
 (0)