Skip to content

Commit

Permalink
aggregation item test
Browse files Browse the repository at this point in the history
  • Loading branch information
flacoman91 committed Nov 12, 2024
1 parent 8e06b0f commit 7a03b94
Show file tree
Hide file tree
Showing 2 changed files with 188 additions and 169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,16 @@ const appliedFilters = ({ fieldName, item, aggs, filters }) => {
};

export const AggregationItem = ({ fieldName, item }) => {
const { data: aggsState } = useGetAggregations();
const { data: aggsState, isSuccess } = useGetAggregations();
const filtersState = useSelector(selectFiltersRoot);
const dispatch = useDispatch();
const aggs = coalesce(aggsState, fieldName, []);
const filters = coalesce(filtersState, fieldName, []);

if (!isSuccess || !aggs) {
return null;
}

const isActive =
filters.includes(item.key) ||
filters.includes(item.key.split(SLUG_SEPARATOR)[0]);
Expand Down
Loading

0 comments on commit 7a03b94

Please sign in to comment.