diff --git a/client/src/app/components/FilterToolbar/SelectFilterControl.tsx b/client/src/app/components/FilterToolbar/SelectFilterControl.tsx index e33eb5083..b1b6bf418 100644 --- a/client/src/app/components/FilterToolbar/SelectFilterControl.tsx +++ b/client/src/app/components/FilterToolbar/SelectFilterControl.tsx @@ -5,6 +5,7 @@ import { Select, SelectList, SelectOption, + ToolbarChip, ToolbarFilter, } from "@patternfly/react-core"; import { IFilterControlProps } from "./FilterControl"; @@ -56,8 +57,9 @@ export const SelectFilterControl = ({ setIsFilterDropdownOpen(false); }; - const onFilterClear = (chip: string) => { - const newValue = filterValue?.filter((val) => val !== chip); + const onFilterClear = (chip: string | ToolbarChip) => { + const chipValue = typeof chip === "string" ? chip : chip.key; + const newValue = filterValue?.filter((val) => val !== chipValue); setFilterValue(newValue?.length ? newValue : null); }; @@ -90,7 +92,7 @@ export const SelectFilterControl = ({ onFilterClear(chip as string)} + deleteChip={(_, chip) => onFilterClear(chip)} categoryName={category.title} showToolbarItem={showToolbarItem} >