Skip to content

Commit

Permalink
Update micro-ui/web/micro-ui-internals/packages/modules/workbench/src…
Browse files Browse the repository at this point in the history
…/components/MultiSelect.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
jagankumar-egov and coderabbitai[bot] authored Jul 17, 2024
1 parent d2a861f commit 030cf5f
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,11 @@ const CustomSelectWidget = (props) => {
setSelectedDetails(mainData?.filter((obj) => (multiple ? value?.includes(obj.uniqueIdentifier) : obj.uniqueIdentifier == value)));

// Update formattedOptions2
let newFormattedOptions2 = [...formattedOptions];
if (value && value !== "") {
const existingOption = formattedOptions.find((option) => option.value === value);
if (!existingOption) {
newFormattedOptions2.push({ value, label: `${schemaCode}_${value}` });
// const updatedSelectedDetails = mainData?.filter((obj) => (multiple ? value?.includes(obj.uniqueIdentifier) : obj.uniqueIdentifier == value));
// setSelectedDetails(updatedSelectedDetails);
useEffect(() => {
if (value && !formattedOptions.some(option => option.value === value)) {
setFormattedOptions2(prevOptions => [...prevOptions, { value, label: `${schemaCode}_${value}` }]);
}
}
setFormattedOptions2(newFormattedOptions2);
}, [value, formattedOptions]);

}, [formattedOptions, optionsLimit,value]);
const onClickSelect = (selectedValue) => {
Expand Down

0 comments on commit 030cf5f

Please sign in to comment.