From 9964d9683f859ecf40748c5326dec8fcbee1115c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Castillo?= Date: Tue, 9 Dec 2025 15:38:55 -0300 Subject: [PATCH] fix: adjust empty values from mui autocomplete clear icon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Castillo --- src/components/inputs/company-input-v2.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/inputs/company-input-v2.js b/src/components/inputs/company-input-v2.js index bfc80df..267a26d 100644 --- a/src/components/inputs/company-input-v2.js +++ b/src/components/inputs/company-input-v2.js @@ -68,13 +68,21 @@ const CompanyInputV2 = ({ summitId, isRequired, sx, onChange, id, name, label, v }} onChange={(_, newValue) => { let tmpValue = newValue?.inputValue || newValue; + // empty option + if (newValue === null) { + tmpValue = { id: null, name: '' }; + } + // if the company name is a string + else if (typeof newValue === 'string') { + tmpValue = { id: 0, name: newValue }; + } // if new option is selected ... - if (newValue && typeof newValue === 'object' && newValue.inputValue) { + else if (newValue && typeof newValue === 'object' && newValue.inputValue) { tmpValue = { id: 0, name: newValue.inputValue }; - } + } setOptions(tmpValue ? [tmpValue, ...options] : options); let ev = { target: {