Skip to content

Commit

Permalink
fix: remove default value code
Browse files Browse the repository at this point in the history
  • Loading branch information
Salman-Apptware committed Nov 21, 2023
1 parent 2a5b5c7 commit e68a91b
Showing 1 changed file with 0 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,18 +332,7 @@ export const EditOwnersModal = ({
function handleBlur() {
setInputValue('');
}
const [defaultValue, setDefaultValue] = useState<any>();

// If the modal content is dynamic or the modal is not rendered immediately.
// we ned need to use the useEffect hook to ensure that the Select component gets the default value after the modal is mounted.
useEffect(() => {
const defaultOwner = selectedOwners.map((owner) => ({
key: owner.value.ownerUrn,
value: owner.value.ownerUrn,
label: owner.label,
}));
setDefaultValue(defaultOwner);
}, [selectedOwners]);
return (
<Modal
title={title || `${operationType === OperationType.ADD ? 'Add' : 'Remove'} Owners`}
Expand Down Expand Up @@ -387,7 +376,6 @@ export const EditOwnersModal = ({
tagRender={tagRender}
onBlur={handleBlur}
value={selectedOwners as any}
defaultValue={defaultValue}
>
{ownerSearchOptions}
</SelectInput>
Expand Down

0 comments on commit e68a91b

Please sign in to comment.