diff --git a/packages/esm-patient-registration-app/src/patient-registration/field/person-attributes/coded-person-attribute-field.component.tsx b/packages/esm-patient-registration-app/src/patient-registration/field/person-attributes/coded-person-attribute-field.component.tsx index 5a2a5e02d..3a8b75241 100644 --- a/packages/esm-patient-registration-app/src/patient-registration/field/person-attributes/coded-person-attribute-field.component.tsx +++ b/packages/esm-patient-registration-app/src/patient-registration/field/person-attributes/coded-person-attribute-field.component.tsx @@ -26,12 +26,13 @@ export function CodedPersonAttributeField({ const { data: conceptAnswers, isLoading: isLoadingConceptAnswers } = useConceptAnswers( customConceptAnswers.length ? '' : answerConceptSetUuid, ); + const { t } = useTranslation(); const fieldName = `attributes.${personAttributeType.uuid}`; const [error, setError] = useState(false); useEffect(() => { - if (!answerConceptSetUuid) { + if (!answerConceptSetUuid && !customConceptAnswers.length) { reportError( t( 'codedPersonAttributeNoAnswerSet', @@ -41,10 +42,10 @@ export function CodedPersonAttributeField({ ); setError(true); } - }, [answerConceptSetUuid]); + }, [answerConceptSetUuid, customConceptAnswers]); useEffect(() => { - if (!isLoadingConceptAnswers) { + if (!isLoadingConceptAnswers && !customConceptAnswers.length) { if (!conceptAnswers) { reportError( t( @@ -69,7 +70,7 @@ export function CodedPersonAttributeField({ setError(true); } } - }, [isLoadingConceptAnswers, conceptAnswers]); + }, [isLoadingConceptAnswers, conceptAnswers, customConceptAnswers]); const answers = useMemo(() => { if (customConceptAnswers.length) {