Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Update vector alert on layer remove #2884

Benjamin Kingc8dd3d7ed948
diff --git a/web/js/modules/alerts/reducer.js b/web/js/modules/alerts/reducer.js
index d56afc635..c3058f651 100644
--- a/web/js/modules/alerts/reducer.js
+++ b/web/js/modules/alerts/reducer.js
@@ -1,5 +1,7 @@
import { assign as lodashAssign } from 'lodash';
import { TOGGLE_VECTOR_ALERT, DISABLE_VECTOR_ALERT, ACTIVATE_VECTOR_ALERT } from './constants';
+import { hasVectorLayers } from '../layers/util';
+import { REMOVE_LAYER } from '../layers/constants';
export const defaultAlertState = {
isVectorAlertActive: false,
@@ -19,6 +21,16 @@ export function alertReducer(state = defaultAlertState, action) {
return lodashAssign({}, state, {
isVectorAlertActive: true,
});
+ case REMOVE_LAYER:
+ if (!state.isVectorAlertActive) {
+ return state;
+ } if (!hasVectorLayers(action.layers)) {
+ return lodashAssign({}, state, {
+ isVectorAlertActive: false,
+ });
+ }
+ return state;
+
default:
return state;
}