Skip to content

Commit ebb6be2

Browse files
fix: default values for array (#798)
1 parent 97fd6b9 commit ebb6be2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/form/helper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { snakeCaseToTitleCase } from "@/lib/strings";
2-
import { JSONSchemaDefinition } from "@/types/forms";
32
import { isArray, isObject } from "@/lib/type-guards";
3+
import { JSONSchemaDefinition } from "@/types/forms";
44

55
export function isTextField(schema: JSONSchemaDefinition) {
66
return schema.type === "string";
@@ -97,7 +97,7 @@ export function generateDefaultValues(
9797
value === "True" ? true : value === "False" ? false : Boolean(value);
9898
} else {
9999
(defaultValues as Record<string, any>)[key] = isArray(value)
100-
? value.map((i) => JSON.stringify(i))
100+
? value.map((i) => (isObject(i) || isArray(i) ? JSON.stringify(i) : i))
101101
: isObject(value)
102102
? JSON.stringify(value)
103103
: value;

0 commit comments

Comments
 (0)