Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ should change the heading of the (upcoming) version to include a major version b
## @rjsf/utils

- fixed issue with customValidate errors are not cleared when the form is valid [4365](https://github.com/rjsf-team/react-jsonschema-form/pull/4365) due to regression
- Add missing `experimental_customMergeAllOf` argument to `ensureFormDataMatchingSchema` introduced by [4388](https://github.com/rjsf-team/react-jsonschema-form/pull/4388)

# 5.24.3

Expand Down
11 changes: 7 additions & 4 deletions packages/utils/src/schema/getDefaultFormState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ export function computeDefaults<T = any, S extends StrictRJSFSchema = RJSFSchema
schema,
rootSchema,
rawFormData,
experimental_defaultFormStateBehavior
experimental_defaultFormStateBehavior,
experimental_customMergeAllOf
);
if (!isObject(rawFormData)) {
defaultsWithFormData = mergeDefaultsWithFormData<T>(
Expand All @@ -366,7 +367,8 @@ export function computeDefaults<T = any, S extends StrictRJSFSchema = RJSFSchema
* @param schema - The schema for which the formData state is desired
* @param rootSchema - The root schema, used to primarily to look up `$ref`s
* @param formData - The current formData
* @param experimental_defaultFormStateBehavior - Optional configuration object, if provided, allows users to override default form state behavior
* @param [experimental_defaultFormStateBehavior] - Optional configuration object, if provided, allows users to override default form state behavior
* @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas
* @returns - valid formData that matches schema
*/
export function ensureFormDataMatchingSchema<
Expand All @@ -378,9 +380,10 @@ export function ensureFormDataMatchingSchema<
schema: S,
rootSchema: S,
formData: T | undefined,
experimental_defaultFormStateBehavior?: Experimental_DefaultFormStateBehavior
experimental_defaultFormStateBehavior?: Experimental_DefaultFormStateBehavior,
experimental_customMergeAllOf?: Experimental_CustomMergeAllOf<S>
): T | T[] | undefined {
const isSelectField = !isConstant(schema) && isSelect(validator, schema, rootSchema);
const isSelectField = !isConstant(schema) && isSelect(validator, schema, rootSchema, experimental_customMergeAllOf);
let validFormData: T | T[] | undefined = formData;
if (isSelectField) {
const getOptionsList = optionsList(schema);
Expand Down