Skip to main content
Version: Current (v7.0.0-beta.3)

getDefaultFormState() takes a SchemaContext and a props object

Detect​

  • In your code, a call to getDefaultFormState() imported from @rjsf/utils with positional arguments after the validator.
  • The type checker reports Expected 2 arguments, but got 5. (TS2554, with your argument count) on the call.

Change​

getDefaultFormState() had the longest list of optional parameters, most of them easy to pass in the wrong order. It now takes a SchemaContext followed by a GetDefaultFormStateProps object:

-getDefaultFormState(validator, schema, formData, rootSchema, false, defaultFormStateBehavior, customMergeAllOf, undefined, uiSchema);
+getDefaultFormState({ validator, customMergeAllOf, defaultFormStateBehavior }, { schema, formData, rootSchema, uiSchema });

Its props are schema, formData?, rootSchema?, includeUndefinedValues?, initialDefaultsGenerated?, uiSchema? and uiSchemaDefinitions?, with the same meanings and defaults the positional parameters had.

SchemaUtilsType.getDefaultFormState() is unchanged.

Verify​

The type checker accepts the call, and it returns the same defaults as before.

Also read: