better parsing of value and default value (#31110)

fixes: #31085

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-07-19 11:15:46 +02:00 committed by GitHub
parent e99f99b8de
commit 64c6dc00c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -49,14 +49,15 @@ export const MultiLineInput = ({
? stringToMultiline( ? stringToMultiline(
Array.isArray(value) && value.length === 1 ? value[0] : value, Array.isArray(value) && value.length === 1 ? value[0] : value,
) )
: value; : Array.isArray(value)
? value
: [value];
values = if (!Array.isArray(values) || values.length === 0) {
Array.isArray(values) && values.length !== 0 values = (stringify
? values
: (stringify
? stringToMultiline(defaultValue as string) ? stringToMultiline(defaultValue as string)
: defaultValue) || [""]; : defaultValue) || [""];
}
return values; return values;
}, [value]); }, [value]);