From 7a8eb28a55e314f49a8d7261fb21abfed62209dd Mon Sep 17 00:00:00 2001 From: Sylvain Bouzols Date: Tue, 3 Oct 2023 15:00:49 +0200 Subject: [PATCH] Fix ElementSearchDialog Autocomplete onChange (#305) Signed-off-by: sBouzols --- .../ElementSearchDialog/element-search-dialog.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/ElementSearchDialog/element-search-dialog.js b/src/components/ElementSearchDialog/element-search-dialog.js index 97ff7054..15586beb 100644 --- a/src/components/ElementSearchDialog/element-search-dialog.js +++ b/src/components/ElementSearchDialog/element-search-dialog.js @@ -89,9 +89,13 @@ const ElementSearchDialog = (props) => { handleSearchTermChange(value); } }} - onChange={(_event, newValue) => { - onSelectionChange(newValue); - setValue(null); + onChange={(_event, newValue, reason) => { + if (reason === 'selectOption') { + onSelectionChange(newValue); + setValue(newValue); + } else { + setValue(null); + } }} getOptionLabel={(option) => option.label} isOptionEqualToValue={(option, value) =>