Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
Lodash.memoize typings added (#1827)
dariaterekhovaae1034c33d44d2
diff --git a/package.json b/package.jsonindex adc481087..22ebbc46e 100644--- a/package.json+++ b/package.json@@ -114,6 +114,7 @@"@types/lodash.flattendeep": "^4.4.7","@types/lodash.get": "^4.4.6","@types/lodash.isequal": "^4.5.5",+ "@types/lodash.memoize": "^4.1.7","@types/lodash.pick": "^4.4.6","@types/lodash.throttle": "^4.1.7","@types/lodash.uniq": "^4.5.7",diff --git a/src/reducers/map-style-updaters.ts b/src/reducers/map-style-updaters.tsindex cd6f6c43a..dc82ab644 100644--- a/src/reducers/map-style-updaters.ts+++ b/src/reducers/map-style-updaters.ts@@ -184,6 +184,13 @@ const mapStyleUpdaters = null;*/export const INITIAL_MAP_STYLE: MapStyle = getDefaultState();+interface GetMapStylesParam {+ styleType: string;+ visibleLayerGroups: {[id: string]: LayerGroup | boolean};+ topLayerGroups: {[id: string]: LayerGroup | boolean};+ mapStyles: {[id: string]: any}+}+/*** Create two map styles from preset map style, one for top map one for bottom*@@ -193,7 +200,7 @@ export const INITIAL_MAP_STYLE: MapStyle = getDefaultState();* @param {Object} mapStyles - a dictionary of all map styles* @returns {Object} bottomMapStyle | topMapStyle | isRaster*/-export function getMapStyles({styleType, visibleLayerGroups, topLayerGroups, mapStyles}) {+export function getMapStyles({styleType, visibleLayerGroups, topLayerGroups, mapStyles}: GetMapStylesParam) {const mapStyle = mapStyles[styleType];// style might not be loaded yet@@ -211,7 +218,7 @@ export function getMapStyles({styleType, visibleLayerGroups, topLayerGroups, mapvisibleLayerGroups});- const hasTopLayer = editable && Object.values(topLayerGroups).some(v => v);+ const hasTopLayer = editable > 0 && Object.values(topLayerGroups).some(v => v);// mute top layer if not visible in bottom layerconst topLayers =@@ -221,12 +228,11 @@ export function getMapStyles({styleType, visibleLayerGroups, topLayerGroups, map...accu,[key]: topLayerGroups[key] && visibleLayerGroups[key]}),- {}+ {} as {[id: string]: LayerGroup | boolean});const topMapStyle = hasTopLayer? editTopMapStyle({- id: styleType,mapStyle,visibleLayerGroups: topLayers})diff --git a/src/utils/map-style-utils/mapbox-gl-style-editor.ts b/src/utils/map-style-utils/mapbox-gl-style-editor.tsindex 7deef4672..dce0027a5 100644--- a/src/utils/map-style-utils/mapbox-gl-style-editor.ts+++ b/src/utils/map-style-utils/mapbox-gl-style-editor.ts@@ -36,7 +36,7 @@ export function getDefaultLayerGroupVisibility({layerGroups = []}: {layerGroups:);}-const resolver = ({id, mapStyle, visibleLayerGroups = {}}) =>+const resolver = ({id, mapStyle, visibleLayerGroups = {}}: {id?: string; mapStyle: BaseMapStyle; visibleLayerGroups: {[id: string]: LayerGroup | boolean} | false}) =>`${id}:${Object.keys(visibleLayerGroups).filter(d => visibleLayerGroups[d]).sort()@@ -50,7 +50,7 @@ const resolver = ({id, mapStyle, visibleLayerGroups = {}}) =>* @returns top map style*/export const editTopMapStyle = memoize(- ({mapStyle, visibleLayerGroups}: {mapStyle: BaseMapStyle; visibleLayerGroups: LayerGroup[]}) => {+ ({mapStyle, visibleLayerGroups}: {mapStyle: BaseMapStyle; visibleLayerGroups: {[id: string]: LayerGroup | boolean} | false}) => {const visibleFilters = (mapStyle.layerGroups || []).filter(lg => visibleLayerGroups[lg.slug]).map(lg => lg.filter);diff --git a/yarn.lock b/yarn.lockindex 8eab4d0c0..0dc4e66c6 100644--- a/yarn.lock+++ b/yarn.lock@@ -3317,6 +3317,13 @@dependencies:"@types/lodash" "*"+"@types/lodash.memoize@^4.1.7":+ version "4.1.7"+ resolved "https://registry.yarnpkg.com/@types/lodash.memoize/-/lodash.memoize-4.1.7.tgz#aff94ab32813c557cbc1104e127030e3d60a3b27"+ integrity sha512-lGN7WeO4vO6sICVpf041Q7BX/9k1Y24Zo3FY0aUezr1QlKznpjzsDk3T3wvH8ofYzoK0QupN9TWcFAFZlyPwQQ==+ dependencies:+ "@types/lodash" "*"+"@types/lodash.pick@^4.4.6":version "4.4.6"resolved "https://registry.yarnpkg.com/@types/lodash.pick/-/lodash.pick-4.4.6.tgz#ae4e8f109e982786313bb6aac4b1a73aefa6e9be"