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

getDefaultFormState internals and calculateIndexScore have no import path

Detect​

  • computeDefaults, getObjectDefaults, getArrayDefaults, getDefaultBasedOnSchemaType, AdditionalItemsHandling or calculateIndexScore imported from @rjsf/utils/lib in your code.
  • Your bundler fails to resolve that path, or Node throws ERR_PACKAGE_PATH_NOT_EXPORTED.

Change​

Call the public method that wraps them, on registry.schemaUtils in a field, widget or template, or on the SchemaUtilsType that createSchemaUtils() returns elsewhere. For defaults, use schemaUtils.getDefaultFormState(). It returns the full default form state that the internals used to build piece by piece.

In place of calculateIndexScore(), call schemaUtils.getClosestMatchingOption(), which scores each option and returns the index of the best match. For the other paths that went away, see imports from a package's lib folder no longer resolve.

Verify​

  • No code imports from @rjsf/utils/lib.
  • The defaults or option index your code computes match what it computed before.

Also read: