Skip to content

Commit

Permalink
Fix path prop usage of DispatchField
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarmueller committed Feb 18, 2019
1 parent 32c5986 commit 374b6d5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions packages/material/src/complex/MaterialTableControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,10 @@ const NonEmptyCell = ({
scopedSchema,
errors
}: NonEmptyCellProps) => {
const path = rowPath + (scopedSchema.type === 'object' ? '.' + propName : '');
const errorsPerEntry: any[] = filter(
errors,
error => error.dataPath === rowPath + '.' + propName
error => error.dataPath === path
).map(e => e.message);
const isValid = isEmpty(errorsPerEntry);
return (
Expand All @@ -155,7 +156,7 @@ const NonEmptyCell = ({
undefined,
scopedSchema.type === 'object' ? `#/properties/${propName}` : '#'
)}
path={rowPath}
path={path}
/>
<FormHelperText error={!isValid}>
{!isValid && formatErrorMessage(errorsPerEntry)}
Expand Down
2 changes: 1 addition & 1 deletion packages/vanilla/src/complex/TableArrayControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class TableArrayControl extends React.Component<
<DispatchField
schema={schema}
uischema={createControlElement(prop)}
path={childPath}
path={childPath + '.' + prop}
/>
</td>
);
Expand Down
4 changes: 2 additions & 2 deletions packages/vanilla/src/controls/InputControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class InputControl extends Control<
schema,
visible,
required,
parentPath,
path,
fields
} = this.props;

Expand Down Expand Up @@ -93,7 +93,7 @@ export class InputControl extends Control<
<DispatchField
uischema={uischema}
schema={schema}
path={parentPath}
path={path}
id={id + '-input'}
/>
<div className={divClassNames}>
Expand Down

0 comments on commit 374b6d5

Please sign in to comment.