Skip to content

Commit

Permalink
fix selectAll
Browse files Browse the repository at this point in the history
  • Loading branch information
ashokaditya committed Dec 12, 2024
1 parent aa159e9 commit ee15e45
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,17 @@ export const ChartsFilter = memo<ChartsFilterProps>(
);

const onSelectAll = useCallback(() => {
const allItems: FilterItems = items.map((item) => {
return {
...item,
checked: item.key && !item.isGroupLabel ? 'on' : undefined,
};
});
const allItems: FilterItems = items.reduce<FilterItems>((acc, item) => {
if (!item.isGroupLabel) {
acc.push({
...item,
checked: 'on',
});
} else {
acc.push(item);
}
return acc;
}, []);
setItems(allItems);
const optionsToSelect = allItems.map((i) => i.label);
onChangeFilterOptions(optionsToSelect);
Expand Down

0 comments on commit ee15e45

Please sign in to comment.