npm @rjsf/core 6.11.1

4 hours ago

@rjsf/core

  • Updated markdown-to-jsx from ^9.8.2 to ^9.10.3 (#5420)
  • Fixed Form failing validation with must be boolean (or the matching type error) when the root formData is a falsy value such as false, 0 or ''. Only undefined is now treated as missing before validating, fixing #5404
  • Fix Form crashing with Maximum update depth exceeded when a widget or setFieldValue() calls onChange more than about 50 times in one event (#5631, #5532)
  • Fix Form ignoring later changes after a change whose customValidate or transformErrors throws. The form keeps its state and the error is rethrown from a timeout (#5631)
  • Potentially breaking change: Change setFieldValue() so a throw from customValidate or transformErrors is rethrown from a timeout, so a try/catch around setFieldValue() no longer catches it (#5631)
  • Potentially breaking change: Change Form to no longer call its deprecated omitExtraData() method, so a subclass overriding it no longer affects liveOmit, a submit or validateForm(). A submit no longer calls validateFormWithFormData() either (#5631)
  • Potentially breaking change: Change customValidate, transformErrors and the validator to run while Form renders a change, so they must be pure: they can run more than once per change, and must not set another component's state (#5631)
  • Potentially breaking change: Remove the undocumented Form members pendingChanges and processPendingChange() (#5631)
  • Change noValidate to hide custom errors a widget raised, including ones raised before it was turned on; they show again once it is turned off (#5631)
  • Fix ErrorList and the onChange event still listing a widget's custom error after an edit cleared it, with live validation off (#5631)
  • Change live validation on change to run once per burst of changes in one event, for the last one; the events of the changes before it report the errors from before the burst (#5631)
  • Fix Form reverting changes made in the same event as a submit, or as a blur with liveValidate or liveOmit set to 'onBlur'. A throw from a blur's live validation is now rethrown from a timeout (#5631, #5660)
  • Potentially breaking change: Change a submit to validate and submit the data and schema of the changes made in the same event, rather than those from before them, so onSubmit gets the data the form shows. Its customValidate and transformErrors now run while Form renders, focusOnFirstError is called after the errors render, and a throw is rethrown from a timeout. With createRoot, a change made outside a React event, such as after an await, or in a transition is still not included (#5631)
  • Fix a blur with liveOmit set to 'onBlur' omitting extra data against the schema from before a schema change the parent made in the same event as a field change (#5631)
  • Fix the errors of an old schema coming back after a schema change with live validation off, once another prop such as uiSchema changes, where they also hid a widget's custom error. With live validation on, an error hidden by noValidate now stays hidden after it is turned off until the next edit, even when extraErrors change (#5631)
  • Change a widget's replacement of a validation error to be dropped when a parent storing formData hands the data back, with liveValidate set to 'onBlur'. The field shows the validation error again until the next blur (#5631)

@rjsf/shadcn

  • Fixed RadioWidget not showing the selected value with @radix-ui/react-radio-group 1.4.x, which ignores the per-item checked prop. The RadioGroup is now controlled by the encoded option value, so it also follows a form reset or an outside formData change (#5420)
  • Updated lucide-react to ^1.49.0, which makes Trash2 an alias of Trash: the remove button's icon class changes from lucide-trash2 to lucide-trash, and the PlusCircle/AlertCircle icons gain lucide-plus-circle/lucide-alert-circle classes. Update any CSS or test selectors that target .lucide-trash2 (#5420)

@rjsf/utils

  • Upgraded @x0k/json-schema-merge to ^1.1.0, which merges if/then/else, properties/patternProperties/additionalProperties and items/additionalItems as groups. omitExtraData() merges an object's allOf before evaluating its conditions, and the older merge could pair one entry's else with another entry's if, so data from an inactive branch was kept. The same merge in retrieveSchema() no longer lets an additionalProperties or additionalItems from one allOf entry act on another entry's properties/patternProperties/items
  • Fixed retrieveSchema() treating a $ref shared by several dependencies oneOf branches, allOf entries, then/else branches, anyOf/oneOf options or root properties as a recursion cycle, leaving it unresolved, fixing #5434. Reference resolution now tracks a path-scoped recursion stack, so a $ref is a cycle only when it is already being expanded on the current path, and previously expanded schemas keep their source ref on the path through RJSF_REF_KEY. Shared references resolve in every branch while recursive schemas still terminate
  • Documented on Experimental_DefaultFormStateBehavior.allOf which allOf and if-then-else defaults skipDefaults still provides, related to #3869 (#5444)

@rjsf/validator-ajv8

  • Fixed apps that import only createPrecompiledValidator bundling all of AJV anyway: the default export's customizeValidator() call is now marked pure, so bundlers drop it (#5559)

@rjsf/validator-ata

  • Updated ata-validator from ^1.23.0 to ^1.40.1 (#5420)
  • Updated ata-validator from ^1.40.1 to ^1.56.0. 1.55.0 fixes a crash in precompiled validators: a one-character value under minLength: 1, or an emoji under a maxLength, threw _cpLen is not defined. 1.56.0 loads its code generator on demand in the browser, so with a bundler that splits chunks (Vite, webpack, Rollup) the runtime validator adds about 58 KB gzipped to the first load instead of 135 KB (#5559)
  • Fixed apps that import only createPrecompiledValidator bundling all of ata-validator anyway: the default export's customizeValidator() call is now marked pure, so bundlers drop it (#5559)
  • compileSchemaValidators() and compileSchemaValidatorsCode() now pass ataOptionsOverrides to ata, so options like assertFormat: false apply to the precompiled validator; only verbose was used before. additionalMetaSchemas and schemas overrides with an $id are now compiled into the module, so a custom meta-schema applies there too; they go in under the $id a $ref reaches each by (a draft-04 id in schemas where the entry is read as draft-04) and as the runtime validator ends up with them, a later entry replacing an earlier one with the same $id and the form's own schemas winning. A json-schema.org meta-schema passed in is compiled in too, with a warning giving its size, since ata already ships the official draft-04 to 2020-12 ones. extenderFn and the coerceTypes, removeAdditional and keywords overrides cannot be carried into the generated module: they were dropped silently and now log a warning, once per process, saying the precompiled and runtime validators may disagree. Extra schemas without an $id, which ata requires, log their own warning. Passing suppressDuplicateFiltering to the compile step also warns, pointing to createPrecompiledValidator() (#5559)
  • Fixed ataOptionsOverrides.schemas being dropped by the runtime validator for every schema other than the root once a root schema was registered, a custom meta-schema among them: the root is now added after the caller's schemas instead of in their place, so it still wins over an entry with its $id, an additionalMetaSchemas entry with the root's $id no longer replaces it there, and the root's own validator reads schemas through the same list, so the root and its sub-schemas apply the same rules; a boolean record entry keeps its meaning (#5571)

Dev / docs / playground

  • Upgraded dependencies with minor or patch version bumps across all packages, including nx/@nx/js, vite, @vitejs/plugin-react, @tailwindcss/cli, knip and lint-staged, plus the playground's monaco-editor from ^0.55.1 to ^0.57.0. Added pnpm overrides that pin @types/react and @types/react-dom to React 18 so libraries with an optional @types/react peer don't typecheck against React 19's types, plus one that holds jsdom at ~30.0.1 because 30.1 needs the global Iterator that Node 20 lacks. Renamed the vitest configs to .mts so Vite's native config loader can load them as ESM (#5420)
  • Documented in the allOf section of form-props.md, and on Experimental_DefaultFormStateBehavior.allOf, which allOf and if-then-else defaults skipDefaults still provides, and added tests for those cases, related to #3869 (#5444)
  • Documented precompiled validators for @rjsf/validator-ata in usage/validation.md, and added size-limit canaries that fail if createPrecompiledValidator stops tree-shaking in either validator package (#5559)
  • Documented in usage/validation.md that customValidate() and transformErrors() must be pure, since they can run more than once for a change (#5631)

Don't miss a new core release

NewReleases is sending notifications on new releases.