getDefaultFormState: a whole-value select with `dependencies` loses the default it inherits from its parent
Author: jimmycallinCreated Sep 30, 2026Updated Sep 30, 2026
Labelsneeds triage
A whole-value select (an object enum) that also has dependencies loses the default it inherits from its parent. getDefaultFormState() returns {} where the same schema without dependencies returns the inherited value.
const x = { type: 'object', enum: [{ a: 1 }, { a: 2 }] };
getDefaultFormState(validator, {
type: 'object',
default: { x: { a: 1 } },
properties: { x: { ...x, dependencies: { a: { const: { a: 2 } } } } },
});
// {}
getDefaultFormState(validator, {
type: 'object',
default: { x: { a: 1 } },
properties: { x },
});
// { x: { a: 1 } }This happens on v7 (checked with @rjsf/validator-ajv8 on d899938). @heath-freenome found it in review of #5386, where it was left out of scope. His guess at the cause, not yet confirmed: rawFormData: rawFormData ?? formData in computeDefaults()'s dependencies recursion (packages/utils/src/schema/getDefaultFormState.ts) passes the coerced {} on instead of the inherited default.
Generated with Claude Code
Source: rjsf-team/react-jsonschema-form