fix(Select): select clear button (#4398)

This commit is contained in:
Pedro H. Köhler 2024-10-01 17:42:21 -03:00 committed by GitHub
parent a72192da28
commit a11cd6d6cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -101,6 +101,9 @@ const Select = ({
}}
value={value && Array.isArray(value) ? selectedOptions : value}
onChange={(selectedOptions, { action }) => {
if (selectedOptions === null) {
return onChange(null, action);
}
const newSelection = !selectedOptions.length
? selectedOptions
: selectedOptions.reduce((acc, curr) => acc.concat([curr.value]), []);