Skip to content

Commit

Permalink
feat: Handle time slider in query filters
Browse files Browse the repository at this point in the history
  • Loading branch information
bprusinowski committed Oct 31, 2022
1 parent 821c9aa commit dc6b998
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions app/charts/shared/chart-helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ export const prepareQueryFilters = (
{ chartType, filters, interactiveFiltersConfig }: ChartConfig,
state: InteractiveFiltersState
): Filters => {
let res: QueryFilters;
const dataFiltersActive = interactiveFiltersConfig?.dataFilters.active;

if (chartType !== "table") {
const queryFilters = dataFiltersActive
? { ...filters, ...state.dataFilters }
: filters;
res = queryFilters;
} else {
res = filters;
let queryFilters = filters;
const { dataFilters, timeSlider } = interactiveFiltersConfig || {};

if (chartType !== "table" && dataFilters?.active) {
queryFilters = { ...queryFilters, ...state.dataFilters };
}

res = omitBy(res, (x) => x.type === "single" && x.value === FIELD_VALUE_NONE);
queryFilters = omitBy(queryFilters, (v, k) => {
return (
(v.type === "single" && v.value === FIELD_VALUE_NONE) ||
k === timeSlider?.componentIri
);
});

return res;
return queryFilters;
};

export const useQueryFilters = ({
Expand Down

0 comments on commit dc6b998

Please sign in to comment.