Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ should change the heading of the (upcoming) version to include a major version b

-->

# 5.6.3

## @rjsf/antd

- Fix #3608 by ensuring the root field is always wrapped in Form.Item
Comment thread
nickgros marked this conversation as resolved.
Outdated

# 5.6.2

## Dev / docs / playground
Expand Down
34 changes: 15 additions & 19 deletions packages/antd/src/templates/FieldTemplate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,21 @@ export default function FieldTemplate<
uiSchema={uiSchema}
registry={registry}
>
{id === 'root' ? (
children
) : (
Comment on lines -97 to -99

@nickgros nickgros Apr 22, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason the error didn't show up is because the example in #3608 had a String field as the root, and the error rendering is handled by Form.Item. Since there was no Form.Item, there was no visible error message.

<Form.Item
colon={colon}
hasFeedback={schema.type !== 'array' && schema.type !== 'object'}
help={(!!rawHelp && help) || (rawErrors?.length ? errors : undefined)}
htmlFor={id}
label={displayLabel && label}
labelCol={labelCol}
required={required}
style={wrapperStyle}
validateStatus={rawErrors?.length ? 'error' : undefined}
wrapperCol={wrapperCol}
{...descriptionProps}
>
{children}
</Form.Item>
)}
<Form.Item
colon={colon}
hasFeedback={schema.type !== 'array' && schema.type !== 'object'}
help={(!!rawHelp && help) || (rawErrors?.length ? errors : undefined)}
htmlFor={id}
label={displayLabel && label}
labelCol={labelCol}
required={required}
style={wrapperStyle}
validateStatus={rawErrors?.length ? 'error' : undefined}
wrapperCol={wrapperCol}
{...descriptionProps}
>
{children}
</Form.Item>
</WrapIfAdditionalTemplate>
);
}
Loading