Skip to content

Commit

Permalink
added safe chcek for additional error info
Browse files Browse the repository at this point in the history
  • Loading branch information
shivani170 committed Jan 18, 2024
1 parent b044912 commit 09e87cf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Common/CustomInput/CustomInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ export function CustomInput({
onKeyDown,
required,
additionalErrorInfo,
inputWrapperClassName = ''
inputWrapperClassName = '',
}: CustomInputProps) {

function handleError(error: any): any[] {
if (!Array.isArray(error)) {
return [error]
Expand All @@ -56,7 +55,7 @@ export function CustomInput({
<div className="form__error" key={error}>
<ErrorIcon className="form__icon form__icon--error" />
{error}
{typeof additionalErrorInfo === 'function' && additionalErrorInfo()}
{error && typeof additionalErrorInfo === 'function' && additionalErrorInfo()}
</div>
)
}
Expand Down Expand Up @@ -94,7 +93,7 @@ export function CustomInput({

return (
<div className={`flex column left top ${inputWrapperClassName}`}>
{renderInputLabel()}
{renderInputLabel()}
<input
data-testid={dataTestid}
type={type}
Expand Down

0 comments on commit 09e87cf

Please sign in to comment.