Skip to content

Commit

Permalink
change approch
Browse files Browse the repository at this point in the history
Signed-off-by: Abdelsalem <abdelsalem.hedhili@rte-france.com>
  • Loading branch information
AbdelHedhili committed Nov 9, 2023
1 parent b24e0ae commit 617a58d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/ElementSearchDialog/element-search-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ const ElementSearchDialog = (props) => {
}
}, [searchTermDisabled, searchTermDisableReason]);

// to reset the value between the dialog closing and opening
useEffect(() => {
setValue((old) => (!open ? null : old));
}, [open]);

const handleSearchTermChange = (term) => {
if (term) {
setLoading(true);
Expand Down Expand Up @@ -93,7 +98,6 @@ const ElementSearchDialog = (props) => {
if (reason === 'selectOption') {
onSelectionChange(newValue);
setValue(newValue);
handleClose();
} else {
setValue(null);
}
Expand Down

0 comments on commit 617a58d

Please sign in to comment.