We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4e0e081 commit 00a1ea1Copy full SHA for 00a1ea1
.changeset/cool-eels-argue.md
@@ -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
@@ -240,7 +240,7 @@ export function computeDefaults(
240
isSchemaOfConstantValue(schema) &&
241
experimental_defaultFormStateBehavior.constAsDefaults !== "never"
242
) {
243
- defaults = schema.const;
+ defaults = schema.const ?? schema.enum?.[0];
244
} else if (
245
isSchemaObjectValue(defaults) &&
246
isSchemaObjectValue(schemaDefault)
0 commit comments