@@ -22,7 +22,6 @@ import {combineReducers} from 'redux';
22
22
import { handleActions } from 'redux-actions' ;
23
23
import { routerReducer } from 'react-router-redux' ;
24
24
import keplerGlReducer , { visStateUpdaters } from 'kepler.gl/reducers' ;
25
- import { FILTER_TYPES } from 'kepler.gl/constants' ;
26
25
import { MAP_ID , DATA_ID } from './constants' ;
27
26
import { MARKER_SELECT } from './actions' ;
28
27
import { log } from './utils' ;
@@ -52,6 +51,8 @@ const composedReducer = (state, action) => {
52
51
switch ( action . type ) {
53
52
case MARKER_SELECT :
54
53
return markerSelectUpdater ( state , action ) ;
54
+ default :
55
+ break ;
55
56
}
56
57
57
58
return reducers ( state , action ) ;
@@ -69,7 +70,7 @@ function markerSelectUpdater(state, action) {
69
70
) ;
70
71
const { field, values} = action . payload ;
71
72
const visState = visStateSelector ( state ) ;
72
- let currentFilterIdx = visState . filters . findIndex ( f => f . name === field && f . dataId === DATA_ID && f . tableauMarkerFilter ) ;
73
+ let currentFilterIdx = visState . filters . findIndex ( f => f . name . includes ( field ) && f . dataId . includes ( DATA_ID ) && f . tableauMarkerFilter ) ;
73
74
let nextState = visState ;
74
75
if ( values . length ) {
75
76
if ( currentFilterIdx < 0 ) {
@@ -80,7 +81,7 @@ function markerSelectUpdater(state, action) {
80
81
}
81
82
log ( 'add filter based on marker' )
82
83
// add filter
83
- nextState = visStateUpdaters . addFilterUpdater ( nextState , { dataId : DATA_ID } ) ;
84
+ nextState = visStateUpdaters . addFilterUpdater ( nextState , { dataId : [ DATA_ID ] } ) ;
84
85
85
86
// added filter should be the last one
86
87
const idx = nextState . filters . length - 1 ;
@@ -136,10 +137,10 @@ function getNewFilter(state, idx, field) {
136
137
const newFilter = {
137
138
...state . filters [ idx ] ,
138
139
...filterProp ,
139
- name : field . name ,
140
+ name : [ field . name ] ,
140
141
// can't edit dataId once name is selected
141
142
freeze : true ,
142
- fieldIdx,
143
+ fieldIdx : [ fieldIdx ] ,
143
144
// add tableau identifier to filter
144
145
tableauMarkerFilter : true
145
146
} ;
0 commit comments