displayLabel, rawErrors, hideLabel and getDisplayLabel are deprecated for the field plan
Detect
displayLabel,rawErrorsorhideLabelread from the props of a customFieldTemplate, field or widget in your code.rawErrorsread in a customArrayFieldTemplateorObjectFieldTemplatein your code.getDisplayLabel()orschemaUtils.getDisplayLabel()imported from@rjsf/utilsor called in your code.- Your editor strikes these names through as
@deprecated, or ano-deprecatedlint rule reports them.
Change
SchemaField now plans each field before rendering it (#5490). From the field and widget it renders, and the presentation the registry merges from @rjsf/core, the theme and the Form, it decides who draws the field's label, description, help and errors, under which ids, and the attributes its control carries. The plan reaches the FieldTemplate, the field and its widget as a presentation prop, described in resolveFieldPresentation(), and the props templates and widgets already read are now derived from it. A registry built by hand needs that merged presentation too; see A hand-built Registry needs presentation and classMap.
The deprecated names stay through v7 for a template or widget rendered without a plan, and the props are still handed over in full, for a component that renders the hidden errors its own way. Read the plan instead, or these helpers, which fall back to the old props only when there is no plan:
| You read | Read instead |
|---|---|
displayLabel or getDisplayLabel() in a template | templateDrawsLabel() |
hideLabel in a widget that draws its own label | widgetDrawsLabel() |
rawErrors for a widget's control error state | hasWidgetErrors() |
rawErrors for the label or description a widget draws for its field | fieldShowsOwnErrors() |
rawErrors for the error state in a FieldTemplate, ArrayFieldTemplate or ObjectFieldTemplate | hasErrors |
rawErrors for the error state in a field | presentation.errors.own |
rawErrors for the messages a widget or container template draws | getErrorsToDraw() |
rawErrors for the messages a field draws itself | presentation.errors.messages |
The rawErrors a field, an ArrayFieldTemplate or an ObjectFieldTemplate is handed carry the errors whatever hideError says (#5325). The plan's presentation.errors.messages already has ui:hideError applied. A widget or container template draws those messages only where presentation.errors.by is 'self', since the template draws them under 'template', and getErrorsToDraw() gives it exactly those. A field reads presentation.errors.messages itself, because getErrorsToDraw() gives a field that draws its own errors none, so that a widget it spreads its plan into doesn't draw them again.
- const errors = hideError ? [] : (rawErrors ?? []);
+ const errors = getErrorsToDraw(props);
How a widget or template takes its error state from the plan is in A custom widget or theme takes its error state from hasWidgetErrors and Custom field, array and object templates take their error state from hasErrors. What a template, a widget and a custom field now draw is in A custom FieldTemplate, ObjectFieldTemplate or ArrayFieldTemplate draws what the plan hands it, A custom widget reads its label, description and required marker from the plan and A custom field draws its own label and description.
Verify
- Your editor shows no
@deprecatedstrikethrough on those names. - Your templates and widgets draw the same label and errors as before, and an error hidden by
ui:hideErrorstays hidden.
Also read:
- A custom FieldTemplate, ObjectFieldTemplate or ArrayFieldTemplate draws what the plan hands it
- A custom widget reads its label, description and required marker from the plan
- A custom field draws its own label and description, and the plan wins over hideLabel
- A custom widget or theme takes its error state from hasWidgetErrors
- Custom field, array and object templates take their error state from hasErrors
- A hand-built Registry needs presentation and classMap