Skip to content

Commit

Permalink
[MapFilters] changed crop on maps to make the filter modify instead o…
Browse files Browse the repository at this point in the history
…f add anew
  • Loading branch information
panda01 committed Apr 12, 2016
1 parent ec3f1fb commit 6b6d15f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/ui/public/filter_bar/push_filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ export default function () {
var filters = _.clone($state.filters || []);
var pendingFilter = { meta: { negate: negate, index: index }};
_.extend(pendingFilter, filter);
filters.push(pendingFilter);
if (!filters.length) {
filters.push(pendingFilter);
} else {
const filterKey = _.keys(filter)[0];
filters.forEach(function (filt) {
if (filt.hasOwnProperty(filterKey)) {
_.assign(filt, pendingFilter);
}
});
}
$state.filters = filters;
};
};
Expand Down

0 comments on commit 6b6d15f

Please sign in to comment.