Skip to content

Commit

Permalink
restore error check on input
Browse files Browse the repository at this point in the history
  • Loading branch information
EnzoVezzaro committed Oct 31, 2023
1 parent df4349f commit 8dda0f0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/components/@shared/FormInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,16 @@ function checkError(
parsedFieldName: string[],
field: FieldInputProps<any>
) {
if (
(form?.touched?.[parsedFieldName[0]]?.[parsedFieldName[1]] &&
form?.errors?.[parsedFieldName[0]]?.[parsedFieldName[1]]) ||
(form?.touched[field?.name] &&
form?.errors[field?.name] &&
field.name !== 'files' &&
field.name !== 'links')
) {
return true
}
const touched = getObjectPropertyByPath(form?.touched, field?.name)
const errors = getObjectPropertyByPath(form?.errors, field?.name)

return (
touched &&
errors &&
!field.name.endsWith('.files') &&
!field.name.endsWith('.links') &&
!field.name.endsWith('consumerParameters')
)
}

export default function Input(props: Partial<InputProps>): ReactElement {
Expand Down

0 comments on commit 8dda0f0

Please sign in to comment.