Skip to content

Commit

Permalink
fix: Fix the Select unselect for object values (apache#16062)
Browse files Browse the repository at this point in the history
(cherry picked from commit 1917464)
  • Loading branch information
michael-s-molina authored and villebro committed Aug 10, 2021
1 parent 999c295 commit f376f92
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions superset-frontend/src/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,13 @@ const Select = ({

const handleOnDeselect = (value: string | number | AntdLabeledValue) => {
if (Array.isArray(selectValue)) {
const selectedValues = [
...(selectValue as []).filter(opt => opt !== value),
];
setSelectValue(selectedValues);
if (typeof value === 'number' || typeof value === 'string') {
const array = selectValue as (string | number)[];
setSelectValue(array.filter(element => element !== value));
} else {
const array = selectValue as AntdLabeledValue[];
setSelectValue(array.filter(element => element.value !== value.value));
}
}
setSearchedValue('');
};
Expand Down

0 comments on commit f376f92

Please sign in to comment.