Skip to content

Passing in the customValidate parameter will cause the error message under the input field to display abnormally #4783

@wxllive

Description

@wxllive

Prerequisites

What theme are you using?

core

Version

5.x

Current Behavior

When I pass (data, errors) => errors into the customValidate parameter, changing other inputs in the form causes the existing error messages to sometimes appear and sometimes disappear

Expected Behavior

When I pass (data, errors) => errors into the customValidate parameter, changing other inputs in the form causes the existing error messages to remain displayed

Steps To Reproduce

  1. Create a form using the following code:
<RJSFForm
  showErrorList={false}
  liveValidate
  customValidate={(data, errors, uiSchema) => {
    return errors;
  }}
  schema={{
    type: "object",
    properties: {
      field1: {
        type: "number",
        enum: [1, 2, 3],
      },
      field2: {
        type: "number",
        minimum: 42,
        maximum: 100,
      },
    },
  }}
  uiSchema={{
    field1: {
      "ui:options": {
        widget: "radio",
      },
    },
    field2: {},
  }}
  validator={validator}
/>
  1. Enter 1 in field2
  2. Switch field1 multiple times and observe the error message under field2.

A codesandbox example: https://codesandbox.io/p/sandbox/j2kdsr?file=%2Fsrc%2FApp.tsx%3A34%2C13

Environment

- OS: windows
- Node: 22
- npm: 10

Anything else?

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions