Skip to content

Commit 374b6d5

Browse files
committed
Fix path prop usage of DispatchField
1 parent 32c5986 commit 374b6d5

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

packages/material/src/complex/MaterialTableControl.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,10 @@ const NonEmptyCell = ({
141141
scopedSchema,
142142
errors
143143
}: NonEmptyCellProps) => {
144+
const path = rowPath + (scopedSchema.type === 'object' ? '.' + propName : '');
144145
const errorsPerEntry: any[] = filter(
145146
errors,
146-
error => error.dataPath === rowPath + '.' + propName
147+
error => error.dataPath === path
147148
).map(e => e.message);
148149
const isValid = isEmpty(errorsPerEntry);
149150
return (
@@ -155,7 +156,7 @@ const NonEmptyCell = ({
155156
undefined,
156157
scopedSchema.type === 'object' ? `#/properties/${propName}` : '#'
157158
)}
158-
path={rowPath}
159+
path={path}
159160
/>
160161
<FormHelperText error={!isValid}>
161162
{!isValid && formatErrorMessage(errorsPerEntry)}

packages/vanilla/src/complex/TableArrayControl.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class TableArrayControl extends React.Component<
162162
<DispatchField
163163
schema={schema}
164164
uischema={createControlElement(prop)}
165-
path={childPath}
165+
path={childPath + '.' + prop}
166166
/>
167167
</td>
168168
);

packages/vanilla/src/controls/InputControl.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class InputControl extends Control<
5757
schema,
5858
visible,
5959
required,
60-
parentPath,
60+
path,
6161
fields
6262
} = this.props;
6363

@@ -93,7 +93,7 @@ export class InputControl extends Control<
9393
<DispatchField
9494
uischema={uischema}
9595
schema={schema}
96-
path={parentPath}
96+
path={path}
9797
id={id + '-input'}
9898
/>
9999
<div className={divClassNames}>

0 commit comments

Comments
 (0)