Skip to content

Commit 1102a8c

Browse files
committed
fix setting filter
Signed-off-by: Shan He <[email protected]>
1 parent 17e547c commit 1102a8c

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/components/KeplerGL/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,14 @@ class KeplerGlComponent extends React.Component {
5555
};
5656
const config = keplerConfig ? JSON.parse(keplerConfig) : undefined;
5757
const hasMapStateConfig = Boolean(config && config.config && config.config.mapState);
58-
58+
5959
this.props.dispatch(
6060
addDataToMap({
6161
datasets,
62-
options: {readOnly, centerMap: !hasMapStateConfig},
62+
options: {
63+
readOnly,
64+
centerMap: !hasMapStateConfig
65+
},
6366
config
6467
})
6568
);

src/reducers.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ const composedReducer = (state, action) => {
5151
switch (action.type) {
5252
case MARKER_SELECT:
5353
return markerSelectUpdater(state, action);
54+
default:
55+
break;
5456
}
5557

5658
return reducers(state, action);
@@ -68,7 +70,7 @@ function markerSelectUpdater(state, action) {
6870
);
6971
const {field, values} = action.payload;
7072
const visState = visStateSelector(state);
71-
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);
7274
let nextState = visState;
7375
if (values.length) {
7476
if (currentFilterIdx < 0) {
@@ -79,7 +81,7 @@ function markerSelectUpdater(state, action) {
7981
}
8082
log('add filter based on marker')
8183
// add filter
82-
nextState = visStateUpdaters.addFilterUpdater(nextState, {dataId: DATA_ID});
84+
nextState = visStateUpdaters.addFilterUpdater(nextState, {dataId: [DATA_ID]});
8385

8486
// added filter should be the last one
8587
const idx = nextState.filters.length - 1;
@@ -135,10 +137,10 @@ function getNewFilter(state, idx, field) {
135137
const newFilter = {
136138
...state.filters[idx],
137139
...filterProp,
138-
name: field.name,
140+
name: [field.name],
139141
// can't edit dataId once name is selected
140142
freeze: true,
141-
fieldIdx,
143+
fieldIdx: [fieldIdx],
142144
// add tableau identifier to filter
143145
tableauMarkerFilter: true
144146
};

0 commit comments

Comments
 (0)