🔀 refactor(inputListComponent): improve code readability and handle value conversion from string to array format

📝 WHY: The InputListComponent expects an array format for the value prop, but sometimes it receives a string instead. To prevent errors and ensure smooth operation, we need to handle the conversion from a string to an array with the string as its element. This refactor improves code readability and clarifies the purpose of the value conversion logic.
This commit is contained in:
Cristhian Zanforlin Lousa 2023-08-28 13:52:49 -03:00
commit c6f6e2008e

View file

@ -18,7 +18,7 @@ export default function InputListComponent({
}
}, [disabled]);
//Sometimes value is a string, but the InputListComponent expects an array, so we need to convert it when it's a string to an array with the string inside it to avoid errors
// In certain cases, the value might be in string format, whereas the InputListComponent specifically requires an array format. To ensure smooth operation and prevent potential errors, it's crucial that we handle the conversion from a string to an array with the string as its element.
typeof value === 'string' ? value = [value] : value = value;
return (