Skip to content

Commit

Permalink
fix: use correct label for array and object subfields
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvxd committed Jan 10, 2025
1 parent a5f2d08 commit c00ea00
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
10 changes: 8 additions & 2 deletions packages/core/components/AutoField/fields/ArrayField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,20 @@ export const ArrayField = ({
"undefined"
? readOnlyFields[subFieldName]
: readOnlyFields[wildcardFieldName];

const label = subField.label || fieldName;

return (
<AutoFieldPrivate
key={subFieldName}
name={subFieldName}
label={subField.label || fieldName}
label={label}
id={`${_arrayId}_${fieldName}`}
readOnly={subReadOnly}
field={subField}
field={{
...subField,
label, // May be used by custom fields
}}
value={data[fieldName]}
onChange={(val, ui) => {
onChange(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,19 @@ export const ObjectField = ({
? readOnlyFields[subFieldName]
: readOnlyFields[wildcardFieldName];

const label = subField.label || fieldName;

return (
<AutoFieldPrivate
key={subFieldName}
name={subFieldName}
label={subField.label || fieldName}
label={label}
id={`${id}_${fieldName}`}
readOnly={subReadOnly}
field={subField}
field={{
...subField,
label, // May be used by custom fields
}}
value={data[fieldName]}
onChange={(val, ui) => {
onChange(
Expand Down

0 comments on commit c00ea00

Please sign in to comment.