diff --git a/ui/src/app/form/component/fields/FilterTargetField.js b/ui/src/app/form/component/fields/FilterTargetField.js index bad90052e..2bfd8484d 100644 --- a/ui/src/app/form/component/fields/FilterTargetField.js +++ b/ui/src/app/form/component/fields/FilterTargetField.js @@ -74,7 +74,7 @@ const FilterTargetField = ({ /*eslint-disable react-hooks/exhaustive-deps*/ React.useEffect(() => { - if (term && term.length >= 4) { + if (term?.length >= 4) { searchIds(term); } }, [term]); diff --git a/ui/src/app/form/component/templates/FieldTemplate.js b/ui/src/app/form/component/templates/FieldTemplate.js index 1e2b8f7eb..1203d543a 100644 --- a/ui/src/app/form/component/templates/FieldTemplate.js +++ b/ui/src/app/form/component/templates/FieldTemplate.js @@ -24,8 +24,8 @@ export function FieldTemplate ({ {children}
- {rawHelp && rawErrors.length < 1 && ( - 0 ? "text-danger" : "text-muted"} id={id}> + {rawHelp && rawErrors?.length < 1 && ( + 0 ? "text-danger" : "text-muted"} id={id}> )} diff --git a/ui/src/app/form/component/widgets/OptionWidget.js b/ui/src/app/form/component/widgets/OptionWidget.js index 88648c0c5..142941dd3 100644 --- a/ui/src/app/form/component/widgets/OptionWidget.js +++ b/ui/src/app/form/component/widgets/OptionWidget.js @@ -90,7 +90,7 @@ const OptionWidget = ({ return ( - 0) ? "text-danger" : ""}`}> + 0) ? "text-danger" : ""}`}> {(label || schema.title) && required ? : null} @@ -104,7 +104,7 @@ const OptionWidget = ({ onChange={ _onChange } allowNew={true} multiple={false} - className={`toggle-typeahead ${rawErrors.length > 0 ? "is-invalid" : ""}`} + className={`toggle-typeahead ${rawErrors?.length > 0 ? "is-invalid" : ""}`} options={opts} placeholder={uiSchema['ui:placeholder'] ? translator(uiSchema['ui:placeholder'] ): ''} disabled={disabled || readonly} @@ -122,7 +122,7 @@ const OptionWidget = ({ toggleMenu()} disabled={disabled || readonly} /> )} - {rawErrors.length > 0 && touched && ( + {rawErrors?.length > 0 && touched && ( {rawErrors.map((error, i) => { return ( diff --git a/ui/src/app/form/component/widgets/SelectWidget.js b/ui/src/app/form/component/widgets/SelectWidget.js index 9a2cd421c..76dc99ec6 100644 --- a/ui/src/app/form/component/widgets/SelectWidget.js +++ b/ui/src/app/form/component/widgets/SelectWidget.js @@ -86,7 +86,7 @@ const SelectWidget = ({ return ( - 0 ? "text-danger" : ""}`}> + 0 ? "text-danger" : ""}`}> {(label || schema.title) && required ? : null} @@ -103,7 +103,7 @@ const SelectWidget = ({ disabled={disabled} readOnly={readonly} autoFocus={autofocus} - className={touched && rawErrors.length > 0 ? "is-invalid" : ""} + className={touched && rawErrors?.length > 0 ? "is-invalid" : ""} onBlur={ onBlur && ((event) => { @@ -132,7 +132,7 @@ const SelectWidget = ({ )} - {rawErrors.length > 0 && touched && ( + {rawErrors?.length > 0 && touched && ( {rawErrors.map((error, i) => { return ( diff --git a/ui/src/app/form/component/widgets/TextWidget.js b/ui/src/app/form/component/widgets/TextWidget.js index 08343905f..8554be911 100644 --- a/ui/src/app/form/component/widgets/TextWidget.js +++ b/ui/src/app/form/component/widgets/TextWidget.js @@ -38,10 +38,10 @@ const TextWidget = ({ _onBlur(evt); }; - // const classNames = [rawErrors.length > 0 ? "is-invalid" : "", type === 'file' ? 'custom-file-label': ""] + // const classNames = [rawErrors?.length > 0 ? "is-invalid" : "", type === 'file' ? 'custom-file-label': ""] return ( - 0 && touched ? "text-danger" : ""}`}> + 0 && touched ? "text-danger" : ""}`}> {(label || schema.title) && required ? @@ -56,7 +56,7 @@ const TextWidget = ({ required={required} disabled={disabled} readOnly={readonly} - className={rawErrors.length > 0 && touched ? "is-invalid" : ""} + className={rawErrors?.length > 0 && touched ? "is-invalid" : ""} list={schema.examples ? `examples_${id}` : undefined} type={inputType} value={value || value === 0 ? value : ""} @@ -73,7 +73,7 @@ const TextWidget = ({ })} ) : null} - {rawErrors.length > 0 && touched && ( + {rawErrors?.length > 0 && touched && ( {rawErrors.map((error, i) => { return ( diff --git a/ui/src/app/form/component/widgets/TextareaWidget.js b/ui/src/app/form/component/widgets/TextareaWidget.js index 9afdace93..4dad923ef 100644 --- a/ui/src/app/form/component/widgets/TextareaWidget.js +++ b/ui/src/app/form/component/widgets/TextareaWidget.js @@ -46,7 +46,7 @@ const TextareaWidget = ({ return ( <> - 0 ? "text-danger" : ""}`}> + 0 ? "text-danger" : ""}`}> {(label || schema.title) && required ? : null} @@ -69,7 +69,7 @@ const TextareaWidget = ({ onFocus={_onFocus} /> - {rawErrors.length > 0 && touched && ( + {rawErrors?.length > 0 && touched && ( {rawErrors.map((error, i) => { return ( diff --git a/ui/src/app/form/component/widgets/UpDownWidget.js b/ui/src/app/form/component/widgets/UpDownWidget.js index 4394a070f..9a6941852 100644 --- a/ui/src/app/form/component/widgets/UpDownWidget.js +++ b/ui/src/app/form/component/widgets/UpDownWidget.js @@ -66,7 +66,7 @@ const UpDownWidget = ({ onBlur={onCustomBlur} onFocus={_onFocus} /> - {rawErrors.length > 0 && touched && ( + {rawErrors?.length > 0 && touched && ( {rawErrors.map((error, i) => { return (