Skip to content

Commit

Permalink
[fix] Fix multiple field filtering in setFilterUpdater (#2821)
Browse files Browse the repository at this point in the history
Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>
  • Loading branch information
igorDykhta authored Dec 10, 2024
1 parent c4d1cff commit c5d42dd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/reducers/src/vis-state-updaters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,17 @@ export function setFilterUpdater<S extends VisState>(
for (let i = 0; i < props.length; i++) {
const prop = props[i];
const value = values[i];
const res = _updateFilterProp(newState, newFilter, prop, value, valueIndex);
// We currently do not support passing in name as an array into _updateFilterProp, so we call it multiple times with each name
// See the comment in there as to what should be addressed
let res;
if (prop === 'name' && Array.isArray(value)) {
// eslint-disable-next-line no-loop-func
res = value.reduce((accu, v) => {
return _updateFilterProp(accu, newFilter, prop, v, valueIndex);
}, newState);
} else {
res = _updateFilterProp(newState, newFilter, prop, value, valueIndex);
}
newFilter = res.filter;
newState = res.state;
datasetIdsToFilter = datasetIdsToFilter.concat(res.datasetIdsToFilter);
Expand Down

0 comments on commit c5d42dd

Please sign in to comment.