Skip to content

Commit

Permalink
fix(fuselage): Unable to remove items on PaginatedMultiSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandernsilva committed Sep 5, 2023
1 parent 775de59 commit fde3bcf
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,22 @@ export const PaginatedMultiSelect = ({
currentValue.some((opt) => opt.value === option.value)
);

const internalChanged = (option: PaginatedMultiSelectOption) => {
if (currentValue.some((opt) => opt.value === option.value)) {
const newValue = currentValue.filter((opt) => opt.value !== option.value);
const internalChanged = useMutableCallback(
(option: PaginatedMultiSelectOption) => {
if (currentValue.some((opt) => opt.value === option.value)) {
const newValue = currentValue.filter(
(opt) => opt.value !== option.value
);

setInternalValue(newValue);
return onChange(newValue);
}

const newValue = [...currentValue, option];
setInternalValue(newValue);
return onChange(newValue);
}

const newValue = [...currentValue, option];
setInternalValue(newValue);
return onChange(newValue);
};
);

const [visible, hide, show] = useVisible();

Expand Down

0 comments on commit fde3bcf

Please sign in to comment.