Interactive interface for browsing global, full-resolution satellite imagery
fix bugs breakinig e2e tests
Jason Kent5b8c07bba7ec
diff --git a/web/js/location.js b/web/js/location.jsindex 77e684930..65f80d023 100644--- a/web/js/location.js+++ b/web/js/location.js@@ -1,4 +1,4 @@-import { get, merge } from 'lodash';+import { get } from 'lodash';import update from 'immutability-helper';import { encode } from './modules/link/util';// legacy crutches@@ -99,8 +99,14 @@ export const mapLocationToState = (state, location) => {config,);- // deep merge of initial state with location state- return merge({}, state, stateFromLocation);+ // one level deep merge of newState with defaultState+ Object.keys(stateFromLocation).forEach((key) => {+ const obj = { ...state[key], ...stateFromLocation[key] };+ stateFromLocation = update(stateFromLocation, {+ [key]: { $set: obj },+ });+ });+ return update(state, { $merge: stateFromLocation });}const startTour = checkTourBuildTimestamp(state.config);if (diff --git a/web/js/modules/layers/selectors.js b/web/js/modules/layers/selectors.jsindex 06ca2a340..32f770e0b 100644--- a/web/js/modules/layers/selectors.js+++ b/web/js/modules/layers/selectors.js@@ -445,8 +445,7 @@ export function activateLayersForEventCategory(activeLayers, state) {});// Turn on or add new layerslodashEach(activeLayers, (layer) => {- const id = layer[0];- const visible = layer[1];+ const [id, visible] = layer;const index = lodashFindIndex(newLayers, { id });if (index >= 0) {newLayers = update(newLayers, {@@ -458,7 +457,7 @@ export function activateLayersForEventCategory(activeLayers, state) {{ visible },newLayers,layerConfig,- getLayers(newLayers, { group: 'overlays' }, state).length,+ getLayers(state, { group: 'overlays' }, newLayers).length,);}});diff --git a/web/js/modules/layers/util.js b/web/js/modules/layers/util.jsindex 807cbd338..df76d5603 100644--- a/web/js/modules/layers/util.js+++ b/web/js/modules/layers/util.js@@ -1224,7 +1224,26 @@ export function mapLocationToLayerState(activeB: {groupOverlays: { $set: activeB.groupOverlays },overlayGroups: { $set: getOverlayGroups(activeB.layers) },- layers: { $set: active.layers },+ layers: { $set: activeB.layers },+ },+ },+ });+ }++ if (active.layers && active.groupOverlays && !active.overlayGroups) {+ newStateFromLocation = update(newStateFromLocation, {+ layers: {+ active: {+ overlayGroups: { $set: getOverlayGroups(active.layers) },+ },+ },+ });+ }+ if (activeB.layers && activeB.groupOverlays && !activeB.overlayGroups) {+ newStateFromLocation = update(newStateFromLocation, {+ layers: {+ activeB: {+ overlayGroups: { $set: getOverlayGroups(activeB.layers) },},},});