You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2021/08/10 05:01:12 UTC
[superset] 02/25: fix: Fix the Select unselect for object values
(#16062)
This is an automated email from the ASF dual-hosted git repository.
villebro pushed a commit to branch 1.3
in repository https://gitbox.apache.org/repos/asf/superset.git
commit aec507d35c9deb7f36e7d83eb1eed3ce99bc4d2e
Author: Michael S. Molina <70...@users.noreply.github.com>
AuthorDate: Wed Aug 4 11:52:39 2021 -0300
fix: Fix the Select unselect for object values (#16062)
(cherry picked from commit 1917464d2b357c98903ffbb7ba8b6e068c6102b8)
---
superset-frontend/src/components/Select/Select.tsx | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/superset-frontend/src/components/Select/Select.tsx b/superset-frontend/src/components/Select/Select.tsx
index 624571c..fcdbdfc 100644
--- a/superset-frontend/src/components/Select/Select.tsx
+++ b/superset-frontend/src/components/Select/Select.tsx
@@ -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('');
};