Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[fix] updateVisDataUpdater early exit (#3058)

Igor Dykhtaa0d14b770f32
diff --git a/src/reducers/src/vis-state-updaters.ts b/src/reducers/src/vis-state-updaters.ts
index 616356aab..122f400b3 100644
--- a/src/reducers/src/vis-state-updaters.ts
+++ b/src/reducers/src/vis-state-updaters.ts
@@ -2336,19 +2336,16 @@ export const updateVisDataUpdater = (
// apply config if passed from action
// TODO: we don't handle async mergers here yet
- const previousState = config
+ let updatedState = config
? receiveMapConfigUpdater(state, {
payload: {config, options}
})
: state;
- // indicate that something is in progress
- const setIsLoadingTask = ACTION_TASK().map(() => {
- return setLoadingIndicator({change: 1});
- });
- const updatedState = withTask(previousState, setIsLoadingTask);
-
const datasets = toArray(action.datasets);
+ if (!datasets.length) {
+ return updatedState;
+ }
const createDatasetTasks: Task[] = [];
const notificationTasks: Task[] = [];
@@ -2377,6 +2374,14 @@ export const updateVisDataUpdater = (
)
: null;
+ if (datasetsAllSettledTask) {
+ // indicate that something is in progress
+ const setIsLoadingTask = ACTION_TASK().map(() => {
+ return setLoadingIndicator({change: 1});
+ });
+ updatedState = withTask(updatedState, setIsLoadingTask);
+ }
+
return withTask(updatedState, [
...(datasetsAllSettledTask ? [datasetsAllSettledTask] : []),
...notificationTasks