Skip to content

Commit 00a1ea1

Browse files
committed
1 parent 4e0e081 commit 00a1ea1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/cool-eels-argue.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@sjsf/form": patch
3+
---
4+
5+
Port https://github.com/rjsf-team/react-jsonschema-form/pull/4644

packages/form/src/core/default-state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ export function computeDefaults(
240240
isSchemaOfConstantValue(schema) &&
241241
experimental_defaultFormStateBehavior.constAsDefaults !== "never"
242242
) {
243-
defaults = schema.const;
243+
defaults = schema.const ?? schema.enum?.[0];
244244
} else if (
245245
isSchemaObjectValue(defaults) &&
246246
isSchemaObjectValue(schemaDefault)

0 commit comments

Comments
 (0)