From e480b095b2ce7f6168a8ca13a7730e77fbe9f0a2 Mon Sep 17 00:00:00 2001 From: kostasdano Date: Mon, 11 Mar 2024 10:09:21 +0200 Subject: [PATCH 1/2] fix: select new option label error --- src/components/Select/Select.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/Select/Select.tsx b/src/components/Select/Select.tsx index 353485563..ed461dc5c 100644 --- a/src/components/Select/Select.tsx +++ b/src/components/Select/Select.tsx @@ -165,8 +165,18 @@ const Select = React.forwardRef((props, ref) => { } } else { if (onChange) { - // @ts-ignore - onChange(option); + if (option.isCreated) { + const newOption: SelectOption = { + value: option.value, + label: option.value.toString(), + isCreated: true, + }; + // @ts-ignore + onChange(newOption); + } else { + // @ts-ignore + onChange(option); + } } } From ee552d3a25dc4ed0899bb838317bf1bf5d14519a Mon Sep 17 00:00:00 2001 From: Konstantinos Danochristos <57801353+kostasdano@users.noreply.github.com> Date: Thu, 14 Mar 2024 14:50:04 +0200 Subject: [PATCH 2/2] Update src/components/Select/Select.tsx Co-authored-by: Panagiotis Vourtsis --- src/components/Select/Select.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Select/Select.tsx b/src/components/Select/Select.tsx index ed461dc5c..bbc94c3d5 100644 --- a/src/components/Select/Select.tsx +++ b/src/components/Select/Select.tsx @@ -171,7 +171,7 @@ const Select = React.forwardRef((props, ref) => { label: option.value.toString(), isCreated: true, }; - // @ts-ignore + // @ts-ignore because TS doesnt recognize both (single-select) and (multi-select) option that we set onChange(newOption); } else { // @ts-ignore