From d41bf6cab6ef3d516003f5a6fc01bc953c49c1de Mon Sep 17 00:00:00 2001 From: Shailesh Parmar Date: Fri, 22 Apr 2022 10:16:47 +0530 Subject: [PATCH] Fix issue-4276: UI: Filter Schema once added unable to remove (#4320) --- .../react-select-component/ReactSelectMultiInput.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/react-select-component/ReactSelectMultiInput.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/react-select-component/ReactSelectMultiInput.tsx index 5c9e26fcc7d..c365ea61d9d 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/react-select-component/ReactSelectMultiInput.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/react-select-component/ReactSelectMultiInput.tsx @@ -13,6 +13,7 @@ import { isUndefined } from 'lodash'; import React, { KeyboardEventHandler, useState } from 'react'; +import { MultiValue } from 'react-select'; import CreatableSelect from 'react-select/creatable'; import { reactSelectCustomStyle } from './reactSelectCustomStyle'; @@ -52,6 +53,12 @@ const ReactSelectMultiInput = ({ setinputValue(input); }; + const handleChange = (newValue: MultiValue) => { + const data = newValue as Option[]; + setValues(data); + getTagValue(data.map((v) => v.value)); + }; + const handleKeyDown: KeyboardEventHandler = (event) => { if (!inputValue) return; switch (event.key) { @@ -76,6 +83,7 @@ const ReactSelectMultiInput = ({ placeholder={placeholder} styles={reactSelectCustomStyle} value={values} + onChange={handleChange} onInputChange={handleInputChange} onKeyDown={handleKeyDown} />