Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
Fix newDateEntries typo and formatting fixes (#870)
Jon Sadka858e546e9c14
diff --git a/src/reducers/vis-state-updaters.js b/src/reducers/vis-state-updaters.jsindex f3b34837d..c7c3f03e5 100644--- a/src/reducers/vis-state-updaters.js+++ b/src/reducers/vis-state-updaters.js@@ -512,12 +512,7 @@ export function interactionConfigChangeUpdater(state, action) {* @public*/export function setFilterUpdater(state, action) {- const {- idx,- prop,- value,- valueIndex = 0- } = action;+ const {idx, prop, value, valueIndex = 0} = action;let newState = state;let newFilter = {...state.filters[idx],@@ -546,7 +541,10 @@ export function setFilterUpdater(state, action) {// TODO: Next PR for UI filter name will only update filter name but it won't have side effects// we are gonna use pair of datasets and fieldIdx to update the filterconst datasetId = newFilter.dataId[valueIndex];- const {filter: updatedFilter, dataset: newDataset} = applyFilterFieldName(+ const {+ filter: updatedFilter,+ dataset: newDataset+ } = applyFilterFieldName(newFilter,state.datasets[datasetId],value,@@ -570,7 +568,6 @@ export function setFilterUpdater(state, action) {// only filter the current datasetbreak;default:-break;}@@ -1165,7 +1162,7 @@ export const updateVisDataUpdater = (state, action) => {? action.datasets: [action.datasets];- const newDateEntries = datasets.reduce(+ const newDataEntries = datasets.reduce((accu, {info = {}, data}) => ({...accu,...(createNewDataEntry({info, data}, state.datasets) || {})@@ -1173,7 +1170,7 @@ export const updateVisDataUpdater = (state, action) => {{});- if (!Object.keys(newDateEntries).length) {+ if (!Object.keys(newDataEntries).length) {return state;}@@ -1188,7 +1185,7 @@ export const updateVisDataUpdater = (state, action) => {...previousState,datasets: {...previousState.datasets,- ...newDateEntries+ ...newDataEntries}};@@ -1210,12 +1207,12 @@ export const updateVisDataUpdater = (state, action) => {mergedState = mergeSplitMaps(mergedState, splitMapsToBeMerged);let newLayers = mergedState.layers.filter(- l => l.config.dataId in newDateEntries+ l => l.config.dataId in newDataEntries);if (!newLayers.length) {// no layer merged, find defaults- const result = addDefaultLayers(mergedState, newDateEntries);+ const result = addDefaultLayers(mergedState, newDataEntries);mergedState = result.state;newLayers = result.newLayers;}@@ -1223,7 +1220,7 @@ export const updateVisDataUpdater = (state, action) => {if (mergedState.splitMaps.length) {// if map is split, add new layers to splitMapsnewLayers = mergedState.layers.filter(- l => l.config.dataId in newDateEntries+ l => l.config.dataId in newDataEntries);mergedState = {...mergedState,@@ -1235,17 +1232,17 @@ export const updateVisDataUpdater = (state, action) => {mergedState = mergeInteractions(mergedState, interactionToBeMerged);// if no tooltips merged add default tooltips- Object.keys(newDateEntries).forEach(dataId => {+ Object.keys(newDataEntries).forEach(dataId => {const tooltipFields =mergedState.interactionConfig.tooltip.config.fieldsToShow[dataId];if (!Array.isArray(tooltipFields) || !tooltipFields.length) {- mergedState = addDefaultTooltips(mergedState, newDateEntries[dataId]);+ mergedState = addDefaultTooltips(mergedState, newDataEntries[dataId]);}});let updatedState = updateAllLayerDomainData(mergedState,- Object.keys(newDateEntries)+ Object.keys(newDataEntries));// register layer animation domain,@@ -1299,36 +1296,29 @@ function closeSpecificMapAtIndex(state, action) {* @public*/export const loadFilesUpdater = (state, action) => {-const {files} = action;const filesToLoad = files.map(fileBlob => processFileToLoad(fileBlob));// reader -> parser -> augment -> receiveVisDataconst loadFileTasks = [- Task.all(filesToLoad.map(LOAD_FILE_TASK)).bimap(- results => {- const data = results.reduce(- (f, c) => ({- // using concat here because the current datasets could be an array or a single item- datasets: f.datasets.concat(c.datasets),- // we need to deep merge this thing unless we find a better solution- // this case will only happen if we allow to load multiple keplergl json files- config: {- ...f.config,- ...(c.config || {})- }- }),- {datasets: [], config: {}, options: {centerMap: true}}- );- return addDataToMap(data);- },- loadFilesErr- )+ Task.all(filesToLoad.map(LOAD_FILE_TASK)).bimap(results => {+ const data = results.reduce(+ (f, c) => ({+ // using concat here because the current datasets could be an array or a single item+ datasets: f.datasets.concat(c.datasets),+ // we need to deep merge this thing unless we find a better solution+ // this case will only happen if we allow to load multiple keplergl json files+ config: {+ ...f.config,+ ...(c.config || {})+ }+ }),+ {datasets: [], config: {}, options: {centerMap: true}}+ );+ return addDataToMap(data);+ }, loadFilesErr)];- return withTask(- state,- loadFileTasks- );+ return withTask(state, loadFileTasks);};/**