mirror of
https://github.com/apache/superset.git
synced 2026-05-07 00:44:26 +00:00
fix: Fix the Select unselect for object values (#16062)
(cherry picked from commit 1917464d2b)
This commit is contained in:
committed by
Ville Brofeldt
parent
3c4f4dbf06
commit
aec507d35c
@@ -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('');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user