From 64c6dc00c02fa9e6b0589b86690ba3aac35805bc Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Fri, 19 Jul 2024 11:15:46 +0200 Subject: [PATCH] better parsing of value and default value (#31110) fixes: #31085 Signed-off-by: Erik Jan de Wit --- .../multi-line-input/MultiLineInput.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/js/apps/admin-ui/src/components/multi-line-input/MultiLineInput.tsx b/js/apps/admin-ui/src/components/multi-line-input/MultiLineInput.tsx index 5ff9e7d271..49aa1c6f0f 100644 --- a/js/apps/admin-ui/src/components/multi-line-input/MultiLineInput.tsx +++ b/js/apps/admin-ui/src/components/multi-line-input/MultiLineInput.tsx @@ -49,14 +49,15 @@ export const MultiLineInput = ({ ? stringToMultiline( Array.isArray(value) && value.length === 1 ? value[0] : value, ) - : value; + : Array.isArray(value) + ? value + : [value]; - values = - Array.isArray(values) && values.length !== 0 - ? values - : (stringify - ? stringToMultiline(defaultValue as string) - : defaultValue) || [""]; + if (!Array.isArray(values) || values.length === 0) { + values = (stringify + ? stringToMultiline(defaultValue as string) + : defaultValue) || [""]; + } return values; }, [value]);