only flatten array when it's length is one (#24956)
fixes: #24927 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
parent
a32b58d337
commit
6a60d33d92
1 changed files with 3 additions and 1 deletions
|
@ -110,7 +110,9 @@ export function convertToFormValues<T extends FieldValues>(
|
|||
if (!isEmpty(value)) {
|
||||
const flattened: any = flatten(value, { safe: true });
|
||||
const convertedValues = Object.entries(flattened).map(([key, value]) =>
|
||||
Array.isArray(value) ? [key, value[0]] : [key, value],
|
||||
Array.isArray(value) && value.length === 1
|
||||
? [key, value[0]]
|
||||
: [key, value],
|
||||
);
|
||||
|
||||
convertedValues.forEach(([k, v]) =>
|
||||
|
|
Loading…
Reference in a new issue