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:
parent
e99f99b8de
commit
64c6dc00c0
1 changed files with 8 additions and 7 deletions
|
@ -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]);
|
||||||
|
|
Loading…
Reference in a new issue